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 [email protected].
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.

Reply via email to