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 
> <https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior>.
>  
> 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.

Reply via email to