php-date-format

1.0.7 • Public • Published

php-date-format

NPM

A node.js package for PHP style format date.

  • No dependencies package
  • Support escape

Installation

npm install php-date-format

Usage

var format = require('php-date-format');
// defaults to ISO8601 format and current date
format();
// output: 2024-01-03T15:04:13.020+09:00

// time
format('H:i:s.v', new Date('2024-01-13T15:04:13.02+09:00'));
// output: 15:04:13.020

// week dates
format('Y-\\WW-N');
// ouptut: 2024-W01-3

// RFC 2822 / RFC 5322 formatted date
format('r');
format('D, d M Y H:i:s O');
// output: Wed, 03 Jan 2024 15:04:13 +0900

Formats

Should support most PHP date formats, see https://www.php.net/manual/en/datetime.format.php

Note

  • Only support local time
  • Timezone format (O, P, p) returns local tz (process.env.TZ)
  • Timezone abbreviation (T) does not support. Returns UTC or GMT+0900

Readme

Keywords

Package Sidebar

Install

npm i php-date-format

Weekly Downloads

31

Version

1.0.7

License

MIT

Unpacked Size

12.8 kB

Total Files

6

Last publish

Collaborators

  • yukimi821