System Variables timestamp **solved**
Moderator: Mattk
-
satellitedan
- Fresh Boarder

- Posts: 6
- Joined: Mon Mar 28, 2016 6:23 am
System Variables timestamp **solved**
First post! I've been using meteobridge for about a week or so and every day I'm learning something new.
There are a few things I could not find the answer to as far as making an email/twitter script.
Is there a way to remove a leading zero from a timestamp? For example, I would like 08:20am to show up as 8:20am. I've figured out the am/pm thing but not how to remove the leading zero.
The sunrise/sunset & moonrise/moonset timestamps are in 24hr time. Is there a way to convert it to 12hr time?
I've tried [mbsystem-sunset=apm] but that only returns the 24hr time (19:40) instead of 12hr time (7:40).
The actual time is correct, I just can't figure out how to make it display 12hr time.
Thanks!
There are a few things I could not find the answer to as far as making an email/twitter script.
Is there a way to remove a leading zero from a timestamp? For example, I would like 08:20am to show up as 8:20am. I've figured out the am/pm thing but not how to remove the leading zero.
The sunrise/sunset & moonrise/moonset timestamps are in 24hr time. Is there a way to convert it to 12hr time?
I've tried [mbsystem-sunset=apm] but that only returns the 24hr time (19:40) instead of 12hr time (7:40).
The actual time is correct, I just can't figure out how to make it display 12hr time.
Thanks!
Re: System Variables timestamp
"apm" converter is not defined for sunset/sunrise. I will add this with one of the next updates.
Regarding the leading zero, in which situation are you looking to get rid of it?
Regarding the leading zero, in which situation are you looking to get rid of it?
-
satellitedan
- Fresh Boarder

- Posts: 6
- Joined: Mon Mar 28, 2016 6:23 am
Re: System Variables timestamp
Thank you!
I have a timestamp on a few things, like the min/max temperature. It returns with the leading zero (see attached) Sorry for the large size, I uploaded it from my phone.
I have a timestamp on a few things, like the min/max temperature. It returns with the leading zero (see attached) Sorry for the large size, I uploaded it from my phone.
Re: System Variables timestamp
You can select the to be skipped character and make use of an #if# #then# #else# #fi# clause to skip the leading char if it is a zero.
When you post one of your timestamp variable definitions, I can show as an example how to apply this.
When you post one of your timestamp variable definitions, I can show as an example how to apply this.
-
satellitedan
- Fresh Boarder

- Posts: 6
- Joined: Mon Mar 28, 2016 6:23 am
Re: System Variables timestamp
I appreciate the help. Here is the code for the first line in the table image I posted earlier:
<tr><td>Outdoor Temp</td><td>[th0temp-act=F.1:--]°F</td><td>[th0temp-dmin=F.1:--]°F <font size='1'>[th0temp-dmintime=apm.ij:--]:[th0temp-dmintime.kl][th0temp-dmintime=apm.op]<font size='3'></td><td>[th0temp-dmax=F.1:--]°F <font size='1'>[th0temp-dmaxtime=apm.ij]:[th0temp-dmaxtime.kl][th0temp-dmaxtime=apm.op]<font size='3'></td></tr>
<tr><td>Outdoor Temp</td><td>[th0temp-act=F.1:--]°F</td><td>[th0temp-dmin=F.1:--]°F <font size='1'>[th0temp-dmintime=apm.ij:--]:[th0temp-dmintime.kl][th0temp-dmintime=apm.op]<font size='3'></td><td>[th0temp-dmax=F.1:--]°F <font size='1'>[th0temp-dmaxtime=apm.ij]:[th0temp-dmaxtime.kl][th0temp-dmaxtime=apm.op]<font size='3'></td></tr>
-
satellitedan
- Fresh Boarder

- Posts: 6
- Joined: Mon Mar 28, 2016 6:23 am
Re: System Variables timestamp
Thank you for adding this!admin wrote:"apm" converter is not defined for sunset/sunrise. I will add this with one of the next updates.
-
satellitedan
- Fresh Boarder

- Posts: 6
- Joined: Mon Mar 28, 2016 6:23 am
Re: System Variables timestamp
I just realized that am & pm do not show up for moonrise/moonset. It is fine for sunrise/sunset.
Here is the code I have for that:
Sunrise [mbsystem-sunrise=apm] - Sunset [mbsystem-sunset=apm]<br>Moonrise [mbsystem-moonrise=apm:NoData] - Moonset [mbsystem-moonset=apm:NoData]
This is how it shows up:
Here is the code I have for that:
Sunrise [mbsystem-sunrise=apm] - Sunset [mbsystem-sunset=apm]<br>Moonrise [mbsystem-moonrise=apm:NoData] - Moonset [mbsystem-moonset=apm:NoData]
This is how it shows up:
Re: System Variables timestamp
Latest update should that have fixed. AM/PM display option also surpresses leading zeros in the hours field.
-
satellitedan
- Fresh Boarder

- Posts: 6
- Joined: Mon Mar 28, 2016 6:23 am
Re: System Variables timestamp
Much appreciated!admin wrote:Latest update should that have fixed. AM/PM display option also surpresses leading zeros in the hours field.
Re: System Variables timestamp **solved**
In version 3.7, =apm no longer has any affect on the output for moonrise/moonset (=utc does, though).
My code (is creating a JSON Map):
My code (is creating a JSON Map):
Code: Select all
/cgi-bin/template.cgi?template={"moonrise":"[mbsystem-moonrise=apm:null]"}&contenttype=application/json;charset=utf-8Re: System Variables timestamp **solved**
Are you sure that works as you expected in 3.6? Please give it a try. I am no aware that I did changes there, so please confirm that it is a 3.7 bug before I start investing time again on this.
Re: System Variables timestamp
admin wrote: Mon Mar 28, 2016 5:29 pm You can select the to be skipped character and make use of an #if# #then# #else# #fi# clause to skip the leading char if it is a zero.
When you post one of your timestamp variable definitions, I can show as an example how to apply this.
I too am looking to get rid of a leading zero in a string. I am trying to figure out how to do this but do not see an example. Anyway you can help me out?

