Format timestamps **solved**

All about the standard Meteobridge devices based on mobile routers from TP-Link, D-Link, ASUS

Moderator: Mattk

Post Reply
ajlacy
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: Thu Feb 12, 2015 11:02 pm

Format timestamps **solved**

Post by ajlacy »

I am using the Push Services to send an email "on day change" to have the indoor and outdoor min and max temperatures for the previous day. It is working fine except that I also want to include the timestamp of when the extremes happened. But while I see how to format the current date/time. I don't see a method for any other timestamps. Is there a method that I just don't see?
User avatar
wvdkuil
Platinum Boarder
Platinum Boarder
Posts: 606
Joined: Sun Jul 24, 2011 8:00 pm
Location: Belgium
Contact:

Re: Format timestamps

Post by wvdkuil »

ajlacy wrote:I am using the Push Services to send an email "on day change" to have the indoor and outdoor min and max temperatures for the previous day. It is working fine except that I also want to include the timestamp of when the extremes happened. But while I see how to format the current date/time. I don't see a method for any other timestamps. Is there a method that I just don't see?
Maybe this is what you needhttp://meteobridge.com/wiki/index.php/Templates
Decimals
. . .
When variable returns a string instead of a number (in case of a timestamp for example), "decimal" specification does have a different format and meaning, which allows to select a substring. Specification of the substring consists of two lower-case letters. The first one specifies start point of the substring, second leter the position of last character of the string to be reported. For example, when string is timestamp "20130303121055" a specification of ".ad" selects a substring from first character (position code "a") until fourth character (position code "d").

When you want to grab the time for lowest outdoor temperature of today the template for that will be [th0temp-dmintime.ij:--]:[th0temp-dmintime.kl:--]. "ij" selects the hour part at position 9-10 and "kl" selects minute part at position 11-12 of the timestamp.
ajlacy
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: Thu Feb 12, 2015 11:02 pm

Re: Format timestamps

Post by ajlacy »

That works, I never thought to look at the decimal section to see how to format dates. It is cumbersome but it works.
Post Reply