phpdate
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

phpdate Build Status js-standard-style

date ported to javascript.

why

php's date function is pretty nice for formatting dates. since a lot of php developers use it, it would be nice if it can be used in javascript as well!

install

npm install --save phpdate

usage

// TZ is America/Los_Angeles (DST)
'use strict'
const { date, gmdate } = require('phpdate')
 
console.log(date('Y-m-d H:i:s')) // => 2016-02-27 17:23:50
console.log(gmdate('Y-m-d H:i:s')) // => 2016-02-28 02:23:50

api

their are a few differences from php's implementation.

date(format[, date])

format is the output format of the date. date can be an instance of javascript's Date object. this differs from php, because php's date function takes an integer to specify the time to format.

gmdate(format[, date])

identical to date, but will always use UTC/GMT for the time zone

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    10
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    10
  • 0.1.2
    1,784
  • 0.1.1
    0
  • 0.1.0
    7
  • 0.0.2
    0

Package Sidebar

Install

npm i phpdate

Weekly Downloads

1,427

Version

1.0.0

License

MIT

Unpacked Size

38.6 kB

Total Files

9

Last publish

Collaborators

  • nkcmr