Date/Time Format Change

3,467 views
Skip to first unread message

Jeff DeWolfe

unread,
Jan 29, 2014, 11:56:25 PM1/29/14
to weewx...@googlegroups.com
Hello All- Now that I have Weewx up and running I was hoping to get the webpage working. I was able to change the skin and get the radar image and link updated. However, I would now like to change it so that it displays the observation time in 12hr format and change the date to MM/DD/YYYY. Can someone point me to where I would change that? I've looked in the skin.conf and weewx.conf but didn't see it there. I also looked in the users guide, but didn't find how to change it. Thanks in advance!!

Jeff 

Andrew Milner

unread,
Jan 30, 2014, 12:22:37 AM1/30/14
to weewx...@googlegroups.com
First place of call is always the weewx users guide and customisation guide!!

From the customising guide:

from which you will see that in the template file (which is probably index.html.tmpl) change $current.dateTime to $current.dateTime.format("XXXXXX") where XXXXXX is datetime formatting taken from http://docs.python.org/2/library/datetime.html#strftime-strptime-behavior

That should be enough to do the trick!!

Steve

unread,
Jan 30, 2014, 4:08:12 AM1/30/14
to weewx...@googlegroups.com
This is what my skin.conf looks like for day, month, year. Using the link Andrew supplied, you'll see what they all mean. For 12 hour format, you'll want to replace the %H with %I

    [[TimeFormats]]
        # This section sets the string format to be used
        # each time scale.
        day        = %H:%M
        week       = %H:%M on %A
        month      = %d-%b-%Y %H:%M
        year       = %d-%b-%Y %H:%M
        rainyear   = %d-%b-%Y %H:%M
        current    = %d-%b-%Y %H:%M
        ephem_day  = %H:%M
        ephem_year = %d-%b-%Y %H:%M


Regards,

Steve.


On Thursday, 30 January 2014 15:56:25 UTC+11, Jeff DeWolfe wrote:

Jeff DeWolfe

unread,
Jan 30, 2014, 9:53:17 AM1/30/14
to weewx...@googlegroups.com
Thanks to both of you. I did some fiddling around after Andrew posted the first reply and got it to where I want. Thanks again!


--
You received this message because you are subscribed to a topic in the Google Groups "Weewx user's group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/funRVI-T_p0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

George Alexander

unread,
Sep 15, 2016, 2:01:27 PM9/15/16
to weewx-user
Hi. My apologies for posting on a thread that is so old, however it's the first one that comes up in a Google search so it made no sense to start afresh.

I've read through the customisation guide and the user guide, and it would appear, unless I'm blind, that the files have been changed since this question was first asked. I can't find the Time customisation table in any of the .conf files anywhere. I also can't see the section mentioned above about changing the format in the customisation guide.

I'd like to change the date format to DD.MM.YYYY in the standard skin output. My Pi localisation is set to this already, however both the Standard and Simple skin outputs don't seem to be listening to that, and are outputting MM.DD.YYYY.

Thanks very much.

Dave Webb KB1PVH

unread,
Sep 15, 2016, 2:10:10 PM9/15/16
to weewx...@googlegroups.com
George,

Date Format

FORMAT is a sequence of characters which specifies how output will appear. It comprises some combination of the following sequences:

%%a literal percent sign ("%").
%aThe abbreviated weekday name (e.g., Sun).
%AThe full weekday name (e.g., Sunday).
%bThe abbreviated month name (e.g., Jan).
%Blocale's full month name (e.g., January).
%cThe date and time (e.g., Thu Mar 3 23:05:25 2005).
%CThe current century; like %Y, except omit last two digits (e.g., 20).
%dday of month (e.g., 01).
%Ddate; same as %m/%d/%y.
%eday of month, space padded; same as %_d.
%Ffull date; same as %Y-%m-%d.
%glast two digits of year of ISO week number (see %G).
%Gyear of ISO week number (see %V); normally useful only with %V.
%hsame as %b.
%Hhour (00..23).
%Ihour (01..12).
%jday of year (001..366).
%khour, space padded ( 0..23); same as %_H.
%lhour, space padded ( 1..12); same as %_I.
%mmonth (01..12).
%Mminute (00..59).
%nnewline.
%Nnanoseconds (000000000..999999999).
%plocale's equivalent of either AM or PM; blank if not known.
%Plike %p, but lower case.
%rlocale's 12-hour clock time (e.g., 11:11:04 PM).
%R24-hour hour and minute; same as %H:%M.
%sseconds since 1970-01-01 00:00:00 UTC.
%Ssecond (00..60).
%ttab.
%Ttime; same as %H:%M:%S.
%uday of week (1..7); 1 is Monday.
%Uweek number of year, with Sunday as first day of week (00..53).
%VISO week number, with Monday as first day of week (01..53).
%wday of week (0..6); 0 is Sunday.
%Wweek number of year, with Monday as first day of week (00..53).
%xlocale's date representation (e.g., 12/31/99).
%Xlocale's time representation (e.g., 23:13:48).
%ylast two digits of year (00..99).
%Yyear
%z+hhmm numeric time zone (e.g., -0400).
%:z+hh:mm numeric time zone (e.g., -04:00).
%::z+hh:mm:ss numeric time zone (e.g., -04:00:00).
%:::znumeric time zone with ":" to necessary precision (e.g., -04+05:30).
%Zalphabetic time zone abbreviation (e.g., EDT)



Dave-KB1PVH


--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dave Webb KB1PVH

unread,
Sep 15, 2016, 2:11:08 PM9/15/16
to weewx...@googlegroups.com

George Alexander

unread,
Sep 15, 2016, 2:31:23 PM9/15/16
to weewx-user
Hi Dave. Thanks for that - I managed to use a table like that to get date/time format that way I wanted it on a capture script for the camera on my Pi. What I dont know is where to put the format string - in the weewx.conf file? Or is it the skin template file, or the skin.conf file itself? Unfortunately the link you posted only takes me to my own Google groups main menu, not a particular thread.

Thanks again.

Dave Webb KB1PVH

unread,
Sep 15, 2016, 2:35:14 PM9/15/16
to weewx...@googlegroups.com

Look for this in your skin.conf

[[TimeFormats]]
        #


        # This section sets the string format to be used
        # each time scale.

        #


        day        = %H:%M
        week       = %H:%M on %A
        month      = %d-%b-%Y %H:%M
        year       = %d-%b-%Y %H:%M
        rainyear   = %d-%b-%Y %H:%M

        current    = %B-%d-%Y %H:%M


        ephem_day  = %H:%M
        ephem_year = %d-%b-%Y %H:%M

Dave-KB1PVH

Sent from my Galaxy S7

George Alexander

unread,
Sep 16, 2016, 6:03:50 AM9/16/16
to weewx-user
Thanks very much Dave - I have no idea how I missed that the first time I looked through the skin.conf file.

George Alexander

unread,
Sep 16, 2016, 10:48:59 PM9/16/16
to weewx-user
ahhh so close...

http://203.114.173.126:180/weewx/simple/index.html

For some reason that I have yet to work out, the dates/times on the right under the records have conformed to the change in the skin.conf file, but the labels under the graphs have not. Any suggestions would be greatly received thanks.

Message has been deleted
Message has been deleted

Andrew Milner

unread,
Sep 16, 2016, 10:59:39 PM9/16/16
to weewx-user
bottom_label_format in the images section of the skin.conf

see example in:
Reply all
Reply to author
Forward
0 new messages