Re: [weewx-user] Re: Time Tags and UTC

2019-05-16 Thread Leon Shaner
We're all fine with the timestamps until 2038.  ;-)

https://en.m.wikipedia.org/wiki/Year_2038_problem

Regards,
\Leon
--
Leon Shaner :: Dearborn, Michigan (iPad Pro)

> On May 16, 2019, at 7:23 PM, gjr80  wrote:
> 
> Hi,
> 
> It was a deliberate decision for WeeWX to be timezone unaware, but 
> fortunately we can do some limited utc manipulation using some of the inbuilt 
> utc capabilities of the python datetime module. In this case the easiest 
> approach is likely just putting a little inline python code in your template. 
> Something like:
> 
> #import datetime
> #set $local_dt = datetime.datetime.utcfromtimestamp($current.dateTime.raw)
> #set $utc_formatted = $local_dt.strftime("%d/%m/%Y %H:%M:%S")
> 
> and then when you want to display the utc time just use the $utc_formatted 
> tag in your template, something like:
> 
> The current time is: $current.dateTime (local) or $utc_formatted (UTC)
> 
> would give something like:
> 
> The current time is: 17/05/19 09:18:00 (local) or 16/05/2019 23:18:00 (UTC)
> 
> The only requirement is the code needs to be included at a location in the 
> template before the tag is used. The format of the output can be changed by 
> using the format codes from here. You could go to more trouble and create a 
> tag (or an SLE that returns a tag) that accepts the format string as a 
> parameter but given your intended use this is the simplest approach.
> 
> Gary
> 
>> On Friday, 17 May 2019 08:48:11 UTC+10, Eric Mears wrote:
>> Hi,
>> 
>> I'm running weewx on a raspberry pi connected to a Vantage weather station.
>> 
>> I create a custom report that that National Weather Service downloads hourly.
>> 
>> The National Weather Service requires the times be in UTC.
>> 
>> 
>> I'd like to run my raspberry pi on local time so the weewx reports display 
>> local time.
>> 
>> Is there an option on a Time Tag to display UTC?
>> 
>> I'm currently using variations of 
>> 
>> $current.dateTime.format("%H:%M %Z")
>> 
>> in my custom report, but these all display local time.
>> 
>> 
>> Do I have any options other than running the raspberry pi on UTC?
>> 
>> Thanks,
>> 
>> Eric
>> 
>> 
>> 
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/weewx-user/af9ae8c1-a26a-4ee3-a305-63f83d439fcc%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/4D5481F4-CABF-4295-8FE5-572492E9C7E8%40isylum.org.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: Time Tags and UTC

2019-05-16 Thread Eric Mears
Gary,

Thanks,

I will give that a try.

Eric


On Thursday, May 16, 2019 at 4:23:29 PM UTC-7, gjr80 wrote:
>
> Hi,
>
> It was a deliberate decision for WeeWX to be timezone unaware, but 
> fortunately we can do some limited utc manipulation using some of the 
> inbuilt utc capabilities of the python datetime module. In this case the 
> easiest approach is likely just putting a little inline python code in your 
> template. Something like:
>
> #import datetime
> #set $local_dt = datetime.datetime.utcfromtimestamp($current.dateTime.raw)
> #set $utc_formatted = $local_dt.strftime("%d/%m/%Y %H:%M:%S")
>
> and then when you want to display the utc time just use the $utc_formatted 
> tag in your template, something like:
>
> The current time is: $current.dateTime (local) or $utc_formatted (UTC)
>
> would give something like:
>
> The current time is: 17/05/19 09:18:00 (local) or 16/05/2019 23:18:00 (UTC
> )
>
> The only requirement is the code needs to be included at a location in the 
> template before the tag is used. The format of the output can be changed by 
> using the format codes from here 
> .
>  
> You could go to more trouble and create a tag (or an SLE that returns a 
> tag) that accepts the format string as a parameter but given your intended 
> use this is the simplest approach.
>
> Gary
>
> On Friday, 17 May 2019 08:48:11 UTC+10, Eric Mears wrote:
>>
>> Hi,
>>
>> I'm running weewx on a raspberry pi connected to a Vantage weather 
>> station.
>>
>> I create a custom report that that National Weather Service downloads 
>> hourly.
>>
>> The National Weather Service requires the times be in UTC.
>>
>>
>> I'd like to run my raspberry pi on local time so the weewx reports 
>> display local time.
>>
>> Is there an option on a Time Tag to display UTC?
>>
>> I'm currently using variations of 
>>
>> $current.dateTime.format("%H:%M %Z")
>>
>> in my custom report, but these all display local time.
>>
>>
>> Do I have any options other than running the raspberry pi on UTC?
>>
>> Thanks,
>>
>> Eric
>>
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/9dd93df2-2ff8-42a3-a316-c3f4492b9091%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: Time Tags and UTC

2019-05-16 Thread gjr80
Hi,

It was a deliberate decision for WeeWX to be timezone unaware, but 
fortunately we can do some limited utc manipulation using some of the 
inbuilt utc capabilities of the python datetime module. In this case the 
easiest approach is likely just putting a little inline python code in your 
template. Something like:

#import datetime
#set $local_dt = datetime.datetime.utcfromtimestamp($current.dateTime.raw)
#set $utc_formatted = $local_dt.strftime("%d/%m/%Y %H:%M:%S")

and then when you want to display the utc time just use the $utc_formatted 
tag in your template, something like:

The current time is: $current.dateTime (local) or $utc_formatted (UTC)

would give something like:

The current time is: 17/05/19 09:18:00 (local) or 16/05/2019 23:18:00 (UTC)

The only requirement is the code needs to be included at a location in the 
template before the tag is used. The format of the output can be changed by 
using the format codes from here 
.
 
You could go to more trouble and create a tag (or an SLE that returns a 
tag) that accepts the format string as a parameter but given your intended 
use this is the simplest approach.

Gary

On Friday, 17 May 2019 08:48:11 UTC+10, Eric Mears wrote:
>
> Hi,
>
> I'm running weewx on a raspberry pi connected to a Vantage weather station.
>
> I create a custom report that that National Weather Service downloads 
> hourly.
>
> The National Weather Service requires the times be in UTC.
>
>
> I'd like to run my raspberry pi on local time so the weewx reports display 
> local time.
>
> Is there an option on a Time Tag to display UTC?
>
> I'm currently using variations of 
>
> $current.dateTime.format("%H:%M %Z")
>
> in my custom report, but these all display local time.
>
>
> Do I have any options other than running the raspberry pi on UTC?
>
> Thanks,
>
> Eric
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/af9ae8c1-a26a-4ee3-a305-63f83d439fcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: Time Tags and UTC

2019-05-16 Thread Eric Mears
Hi Peter,

I was looking at 
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow 


but I couldn't figure out how to call it from the tag.

I'm still a newbie at this.

Thanks,

Eric


On Thursday, May 16, 2019 at 3:54:13 PM UTC-7, p q wrote:
>
> I imagine your Raspberry Pi is using UTC as its base time and using the 
> time zone to display the local time. That's the standard way it's set up.
>
> I haven't tried it but you might be able to use the python function 
> datetime.utcnow() 
> https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow 
> 
>
> On Thursday, May 16, 2019 at 3:48:11 PM UTC-7, Eric Mears wrote:
>>
>> Hi,
>>
>> I'm running weewx on a raspberry pi connected to a Vantage weather 
>> station.
>>
>> I create a custom report that that National Weather Service downloads 
>> hourly.
>>
>> The National Weather Service requires the times be in UTC.
>>
>>
>> I'd like to run my raspberry pi on local time so the weewx reports 
>> display local time.
>>
>> Is there an option on a Time Tag to display UTC?
>>
>> I'm currently using variations of 
>>
>> $current.dateTime.format("%H:%M %Z")
>>
>> in my custom report, but these all display local time.
>>
>>
>> Do I have any options other than running the raspberry pi on UTC?
>>
>> Thanks,
>>
>> Eric
>>
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/28c8b185-6ca2-4e1a-b16e-d6ad70fe9149%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[weewx-user] Re: Time Tags and UTC

2019-05-16 Thread p q
I imagine your Raspberry Pi is using UTC as its base time and using the 
time zone to display the local time. That's the standard way it's set up.

I haven't tried it but you might be able to use the python function 
datetime.utcnow() 
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow

On Thursday, May 16, 2019 at 3:48:11 PM UTC-7, Eric Mears wrote:
>
> Hi,
>
> I'm running weewx on a raspberry pi connected to a Vantage weather station.
>
> I create a custom report that that National Weather Service downloads 
> hourly.
>
> The National Weather Service requires the times be in UTC.
>
>
> I'd like to run my raspberry pi on local time so the weewx reports display 
> local time.
>
> Is there an option on a Time Tag to display UTC?
>
> I'm currently using variations of 
>
> $current.dateTime.format("%H:%M %Z")
>
> in my custom report, but these all display local time.
>
>
> Do I have any options other than running the raspberry pi on UTC?
>
> Thanks,
>
> Eric
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/3fa6abc1-b30e-43d7-a089-b3bf0830bf4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.