Date/time formatting for aggregation like "maxsum"

83 views
Skip to first unread message

michael.k...@gmx.at

unread,
Mar 10, 2023, 9:03:46 AM3/10/23
to weewx-user
When I calculate "maxsum" as the maximum daily rain sum per week/month/year/alltime, I am a bit confused by the output when it comes to formatting the date/time for the value. 

For me, having a time for a maximum daily sum doesn't make sense in this context.

So, How can I solve this? I couldn't find out so far, if I can specifiy a special time format for aggregations like "maxsum"

In the template I use $week.rain.maxsumtime, $month.rain.maxsumtime, $year.rain.maxsumtime, $alltime.rain.maxsumtime. The used format makes sense for max, min, maxmin, minmax, but not for a sum.

How can I make the web page show "Wednesday" for "This week", "03/08/2023" for "This month, etc, without the hh:mm:ss added? 

2023-03-10 14_48_03-The weather in Test - Brave.png

Tom Keffer

unread,
Mar 10, 2023, 4:18:12 PM3/10/23
to weewx...@googlegroups.com
Yes, the query is not as optimal as it could be. It's returning the right date, but the time at which maximum rainfall was achieved, rather than midnight. 

You can solve your problem by applying a formatting. For example,

$week.rain.maxsumtime.format("%A"), $month.rain.maxsumtime("%m/%d/%Y), ...

The formatting is from Python's strftime() function.

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/beb4ca00-11f5-4758-bb89-17aec6b2a956n%40googlegroups.com.

michael.k...@gmx.at

unread,
Mar 11, 2023, 2:40:00 PM3/11/23
to weewx-user
That was kind of what I intended to do, but while for $week using "%A" may be OK, using "%m/%d%Y", won't fit in many localizations. Is there a default format for date without time that I should reference or should I just add such the format for the sums setting to each lang file? 

Tom Keffer

unread,
Mar 11, 2023, 6:17:15 PM3/11/23
to weewx...@googlegroups.com
Look through the list of strftime() formats I linked to and see if anything fits your needs. For example, the rest of WeeWX uses %x and %X.

michael.k...@gmx.at

unread,
Mar 12, 2023, 1:47:22 AM3/12/23
to weewx-user
Great, thanks! After all that java, spring, ... during the week, it's not so easy to see the sometimes easiest solutions in another world, thanks again for your inputs.
Reply all
Reply to author
Forward
0 new messages