Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Simple date formatting
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
package.json
readme.mdown
tide.js

readme.mdown

tide is a tiny tool for creating string representations of a) specific Date objects or b) the current time, relative to either the default timezone or UTC.

Usage

var tide = require('tide');

tide('Month Dth YYYY', new Date(0)); // -> "January 1st 1970"
tide('Month Dth YYYY');              // -> "October 1st 2012"

tide('hh:mm:ss zz:zz');              // -> "16:44:28 +01:00"
tide.utc('hh:mm:ss zz:zz');          // -> "15:44:28 +00:00"

Tokens

Dday of the month1, 2, 3, ..., 31
Dthday of the month, with ordinal number suffix1st, 2nd, 3rd, ..., 31st
DDday of the month, with leading zero01, 02, 03, ..., 31
Mmonth1, 2, 3, ..., 12
MMmonth, with leading zero01, 02, 03, ..., 12
YYYYfull year1968, 1969, 1970, ...
YYlast two digits of the year68, 69, 70, ...
hhhours (24-hour format)00, 01, 02, ..., 23
hhours (12-hour format)12, 1, 2, ..., 11
mminutes0, 1, 2, ..., 59
mmminutes, with leading zero00, 01, 02, ..., 59
sseconds0, 1, 2, ..., 59
ssseconds, with leading zero00, 01, 02, ..., 59
msmilliseconds1, 2, 3, ..., 999
mmmsmilliseconds, with leading zero(s)000, 001, 002, ..., 999
Weekdayday of the weekSunday, Monday, Tuesday, ..., Saturday
Wkdday of the week (short)Sun, Mon, Tue, ..., Sat
Monthname of monthJanuary, February, March, ..., December
Mnthname of month (short)Jan, Feb, Mar, ..., Dec
amam/pmam, pm
AMAM/PMAM, PM
zzzztimezone offset-0100, +0000, +01:00, ...
zz:zztimezone offset, with colon-01:00, +00:00, +01:00, ...

Installation

npm install tide

License

Public domain.

Something went wrong with that request. Please try again.