n0bel / PiClock

A Fancy Clock built around a monitor and a Raspberry Pi
MIT License
566 stars 182 forks source link

TimeStamp #121

Open maserowik opened 5 years ago

maserowik commented 5 years ago

I finally had some free time to completely redo my PiClock.
Fantastic work on the upgrade!!!

I do have a time stamp question. Is there a way to use 12 hour time instead of 24 hour time on the radar screen and the Sun Set?

Thanks Mike

togatown commented 5 years ago

If you have unaltered code, open PyQtPiClock.py and go to line 285:

https://github.com/n0bel/PiClock/blob/3f94fd4c7322ee5350f52ce88fcfa004f3d92f21/Clock/PyQtPiClock.py#L285

if "sunriseTime" in wxdata["daily"]["data"][0]: bottomText += (Config.LSunRise + "{0:%H:%M}".format(datetime.datetime.fromtimestamp( wxdata["daily"]["data"][0]["sunriseTime"])) + Config.LSet + "{0:%H:%M}".format(datetime.datetime.fromtimestamp( wxdata["daily"]["data"][0]["sunsetTime"])))

Change "{0:%H:%M}" to "{0:%I:%M}" if you just want the time or "{0:%I:%M %p}" if you want to display AM/PM as well.

n0bel commented 5 years ago

Possibly, it makes sense to move items like this to the config.

BertLindeman commented 5 years ago

This issue alone would be a few lines update on PyQtPiClock.py and on the Config-Example's @n0bel Would you want a separate pull request for this? It may be that @ScottChapman might be taking this along on #125 Or even make another item to concentrate adding Config variables to move data from the program into the Config Would gladly add a pull-request for this. Propose as variablename LtopDateformat with as default: "{0:%A %B} {0.day}<sup>{1}</sup> {0.year}" L for Locale . . . Suggestion for contitental Europe might be '{0:%A %e}{1} {0:%B} {0.year}' Drop here 'sup' but KEEP the {1} to prevent substitution error.