Module datetime
This module contains date translations and helper functions for the KOReader frontend.
Functions
| secondsToClock (seconds, withoutSeconds) | Converts seconds to a clock string. | 
| secondsToHClock (seconds, withoutSeconds, hmsFormat, withDays, compact) | Converts seconds to a period of time string. | 
| secondsToClockDuration (Either, withoutSeconds, withDays, compact) | Converts seconds to a clock type (classic or modern), based on the given format preference "Classic" format calls secondsToClock, "Modern" and "Letters" formats call secondsToHClock | 
| secondsToHour (seconds, twelve_hour_clock) | Converts timestamp to an hour string | 
| secondsToDate (seconds) | Converts timestamp to a date string | 
| secondsToDateTime (seconds, twelve_hour_clock) | Converts timestamp to a date+time string | 
| stringToSeconds (YYYY) | Converts a date+time string to seconds | 
Functions
- secondsToClock (seconds, withoutSeconds)
- 
    Converts seconds to a clock string. 
Source: https://gist.github.com/jesseadams/791673 Parameters:- seconds integer number of seconds
- withoutSeconds boolean if true 00:00, if false 00:00:00
 Returns:- 
           string
        clock string in the form of 00:00 or 00:00:00
    
 
- secondsToHClock (seconds, withoutSeconds, hmsFormat, withDays, compact)
- 
    Converts seconds to a period of time string.
    Parameters:- seconds integer number of seconds
- withoutSeconds boolean if true 1h30', if false 1h30'10"
- hmsFormat boolean , if true format 1h 30m 10s
- withDays boolean , if true format 1d12h30'10" or 1d 12h 30m 10s
- compact boolean , if set removes all leading zeros (incl. units if necessary) and turns thinspaces into hairspaces (if present)
 Returns:- 
           string
        clock string in the form of 1h30'10" or 1h 30m 10s
    
 
- secondsToClockDuration (Either, withoutSeconds, withDays, compact)
- 
    Converts seconds to a clock type (classic or modern), based on the given format preference
 "Classic" format calls secondsToClock, "Modern" and "Letters" formats call secondsToHClock
    Parameters:- Either string "modern" for 1h30'10", "letters" for 1h 30m 10s, or "classic" for 1:30:10
- withoutSeconds boolean if true 1h30' or 1h 30m, if false 1h30'10" or 1h 30m 10s
- withDays boolean , if hours>=24 include days in clock string 1d12h10'10" or 1d 12h 10m 10s
- compact boolean , if set removes all leading zeros (incl. units if necessary) and turns thinspaces into hairspaces (if present)
 Returns:- 
           string
        clock string in the specific format of 1h30', 1h30'10" resp. 1h 30m, 1h 30m 10s
    
 
- secondsToHour (seconds, twelve_hour_clock)
- 
    Converts timestamp to an hour string
    Parameters:- seconds integer number of seconds
- twelve_hour_clock boolean
 Returns:- 
           string
        hour string
    
 
- secondsToDate (seconds)
- 
    Converts timestamp to a date string
    Parameters:- seconds integer number of seconds
 Returns:- 
           string
        date string
    
 
- secondsToDateTime (seconds, twelve_hour_clock)
- 
    Converts timestamp to a date+time string
    Parameters:- seconds integer number of seconds
- twelve_hour_clock boolean
 Returns:- 
           string
        date+time
    
 
- stringToSeconds (YYYY)
- 
    Converts a date+time string to seconds
    Parameters:- YYYY string -MM-DD HH:MM:SS", time may be absent
 Returns:- 
           seconds