Currently I have a problem where I've hard-coded the date and time format 
within the Belchertown skin. I know I need to change it but I'm not sure 
how. 

I'm using a mixture of Python, JavaScript and Cheetah to make it cohesive - 
but for those outside of the USA who want their formats in day/month/year, 
I can't do much to help them. 

This isn't everything, but some examples of how I'm formatting various 
dates within the skin. I think the only thing in common would be that they 
are all epoch - but I would need to verify each instance. 

Cheetah:
$current.dateTime.format("%B %d, %Y at %I:%M %p") # Returns December 28, 
2018, 1:17:18 pm
$almanac.sunset.format("%-I:%M %p") # Returns 7:17 AM
$current.dateTime.format("%A, %B %d, %Y") # Returns Friday, December 28, 
2018
$current.dateTime.format("%B, %Y") # Returns December, 2018

JavaScript:
moment(data["almanac"]["sunrise"], "HH:mm:ss A").format("h:mm A"); # 
Returns 7:17 AM
moment.unix( data['alerts'][i]['expires'] ).format( 'MMMM D, YYYY, h:mm A' 
); # Returns December 31, 2018, 7:00 AM
moment.unix( data["daily"]["data"][i]["time"] ).format( "ddd M/D" ); # 
Returns Sat 12/29
moment.unix(epoch).utcOffset($moment_js_utc_offset).format("MMMM D, YYYY, 
h:mm:ss a"); # Returns December 28, 2018, 1:17:18 pm

Python extension:
time.strftime( "%B %d, %Y at %-I:%M %p", time.localtime( 
at_rainiest_day_query[0] ) ) # Returns July 17, 2018 at 2:35 PM
time.strftime( "%a %m/%d", time.localtime( time.time() ) ) # Returns Sat 
12/29
time.strftime( "%B %d, %Y, %-I:%M %p %Z", time.localtime( eqdata["features"
][0]["properties"]["time"] / 1000 ) ) # Returns December 22, 2018, 10:19 PM 
EST

I see in skin.conf there's [Units] [[TimeFormats]] and I'm sure this is 
probably something I want to tap into - unless this is purely for Cheetah 
tags ($current, $day, etc)?

Can someone point me in the right direction on how best to offer time and 
date formats in the users locale?

Thanks

Reply via email to