switch current time showing on website from 24hr to 12 hr am/pm

764 views
Skip to first unread message

Barry Schwartz

unread,
Feb 13, 2015, 5:04:06 PM2/13/15
to weewx...@googlegroups.com
how do I change $current.datetime or some other variable so that the current date and time of the data on the webpage uses the 12 hr am/pm clock rather than the 24 hr clock?

which file and what variable?

raspi/Debian/weewx 2.64

Thanks for any info

Barry
website at 

Thomas Keffer

unread,
Feb 13, 2015, 5:08:41 PM2/13/15
to weewx-user
It's in the Customizing Guide.

-tk

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

Dave Webb KB1PVH

unread,
Feb 13, 2015, 5:16:27 PM2/13/15
to weewx...@googlegroups.com
Barry,

Look in skin.conf for this

[[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

Change the code to how you want it to look.

CodeMeaningExample
%aWeekday as locale’s abbreviated name.Wed
%AWeekday as locale’s full name.Wednesday
%wWeekday as a decimal number, where 0 is Sunday and 6 is Saturday.3
%dDay of the month as a zero-padded decimal number.25
%bMonth as locale’s abbreviated name.Dec
%BMonth as locale’s full name.December
%mMonth as a zero-padded decimal number.12
%yYear without century as a zero-padded decimal number.13
%YYear with century as a decimal number.2013
%HHour (24-hour clock) as a zero-padded decimal number.17
%IHour (12-hour clock) as a zero-padded decimal number.05
%pLocale’s equivalent of either AM or PM.PM
%MMinute as a zero-padded decimal number.15
%SSecond as a zero-padded decimal number.30
%fMicrosecond as a decimal number, zero-padded on the left.000000
%zUTC offset in the form +HHMM or -HHMM (empty string if the the object is naive).
%ZTime zone name (empty string if the object is naive).
%jDay of the year as a zero-padded decimal number.359
%UWeek number of the year (Sunday as the first day of the week) as a zero padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0.51
%WWeek number of the year (Monday as the first day of the week) as a decimal number. All days in a new year preceding the first Monday are considered to be in week 0.51
%cLocale’s appropriate date and time representation.Wed Dec 25 17:15:30 2013
%xLocale’s appropriate date representation.12/25/13
%XLocale’s appropriate time representation.17:15:30
%%A literal '%' character.%
  

Dave-KB1PVH

Barry Schwartz

unread,
Feb 13, 2015, 11:30:14 PM2/13/15
to weewx...@googlegroups.com
Ok, I found the list and understand to get the data that I want I need to use:
%I:%M %p but I am not sure of the syntax to place this in the weewx/skins/index.html.tmpl  where it now shows $current.datetime

Dave Webb KB1PVH

unread,
Feb 14, 2015, 2:31:03 AM2/14/15
to weewx...@googlegroups.com

Barry,

In the example I gave  you should just need to change all the %H:%M to %I:%M %p in skin.conf.  then stop and start Weewx and the time format will be 12hr clock instead of 24. There's nothing to change in index.html.tmpl

Dave-KB1PVH

Sent from my Samsung S4

Barry Schwartz

unread,
Feb 14, 2015, 11:33:00 AM2/14/15
to weewx...@googlegroups.com
Now I get it. I made the change and it is working the way I want it to.
Linux and setting up whew and raspi, etc has been a steep learning curve if you are not a programer but following all the posted directions that Tom has given and asking a few questions have made all the difference in the world.

Thanks for the help.
Barry


On Friday, February 13, 2015 at 5:04:06 PM UTC-5, Barry Schwartz wrote:

Messy Potamia

unread,
Feb 19, 2015, 10:18:32 PM2/19/15
to weewx...@googlegroups.com
Sorry -- I'm just not getting it. I want the time portion of my Current Weather Conditions header to read "21:10:00" instead of "09:10:00 PM" and I have looked in the configuration guide and I still don't get it, because my skin.conf looks like this:
[[TimeFormats]]
        # This section sets the string format to be used for each time scale.
        # The values below will work in every locale, but may not look
        # particularly attractive. See the Customizing Guide for alternatives.

        day        = %X
        week       = %X (%A)
        month      = %x %X
        year       = %x %X
        rainyear   = %x %X
        current    = %x %X
        ephem_day  = %X
        ephem_year = %x %X
and the descriptions in the post don't make sense to me, i.e. "%X" is described as "locale's appropriate time representation".
Not sure which of the above to change so it forces it to HH:MM:SS and without the AM/PM.

Messy Potamia

unread,
Feb 19, 2015, 10:32:28 PM2/19/15
to weewx...@googlegroups.com
Okay - I get it. Sorry it must be getting late. After experimenting with the "current =" tag, I now know where to change it.
Thank you.
Reply all
Reply to author
Forward
0 new messages