Skip to content

Instantly share code, notes, and snippets.

@mattparker
Created January 10, 2013 21:34
Show Gist options
  • Save mattparker/4505998 to your computer and use it in GitHub Desktop.
Save mattparker/4505998 to your computer and use it in GitHub Desktop.
docblock efforts for strtotime
/**
* @class Date
* @static
*/
/**
* @for Date
* @method strtotime
*
* Parses English (or other languages) date-related sentences into
* a timestamp. A wide range of formats are supported, as is
* relative formats.
*
* Note that to preserve compatability with php (from which this is ported)
* timestamps are in seconds, not milliseconds.
*
* See http://php.net/manual/en/function.strtotime.php for the php write-up
*
* Examples:
* Y.Date.strtotime("2012-05-02") // returns
* Y.Date.strtotime("2/5/2012 5.15pm") // returns
* Y.Date.strtotime("next Thursday", 1360022400) // returns
* Y.Date.strtotime("+3 months and 2 days", 1360022400) // returns
*
*
*
* @static
* @public
*
* @param {String} time Date and/or modifier(s)
* @param {Int} [baseTimestamp] Timestamp (in seconds)
* @return {Int} Parsed timestamp (in seconds) or false if there was an error
*
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment