w2utils.formatTime

Returns time in requested format.
formatTime(dateStr, format)
dateStr string or number, date in common format
format string, format to output
The str argument can be (1) a JavaScript Date, (2) a Unix epoch, (3) any standard date, which will be used to create JavaScript Date object. To ensure correct translation it is best to pass a JavaScript Date.
The format can contain following elements:
  • hh
    - hour
  • hhh
    - hour with leading 0
  • h24
    - hour in 24 hour format
  • hh24
    - hour in 24 hour format with a leading 0
  • mi
    - minute (always with a leading 0)
  • mm
    - minute (always with a leading 0)
  • ss
    - second (always with a leading 0)
  • am
    - am or pm for US format
  • pm
    - am or pm for US format

User Comments

comments powered by Disqus