Converting datetime to Javascript milliseconds in epoch
Useful for transferring datetime values to JS: briefer and overcoming the 1 vs. 0 based month enumeration difference between python and JS.
- datetime
- time
- api
- seconds
- epoch
Useful for transferring datetime values to JS: briefer and overcoming the 1 vs. 0 based month enumeration difference between python and JS.
Does exactly what it says on the tin! This template tag, when implemented, converts a duration (in seconds) to a more meaningful format. It has a short and long setting, which is easy to manipulate for your needs. Apologies if something already exists like this, however I felt that writing this would be quicker than trying to find it online. As an example, given the duration 84658: Short (default): 23 hrs 30 mins 58 secs Long: 23 hours, 30 minutes and 58 seconds All the best, [Dan Ward](http://d-w.me).
l = (1, 23, 60, 75, 3600, 36000) for n in l: print friendly_seconds(n) 00:00:01 00:00:23 00:01:00 00:01:15 01:00:00 10:00:00