JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 890
  • Score
    100M100P100Q105691F
  • License MIT

php's date function ported to javascript

Package Exports

  • phpdate

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (phpdate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

phpdate

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

'use strict'
var date = require('phpdate')

console.log(date('Y-m-d H:i:s')) // => 2016-02-27 17: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.