https://github.com/2gbeh/php-date-format
Format dates in JavaScript using PHP syntax.
https://github.com/2gbeh/php-date-format
npm-package
Last synced: about 2 months ago
JSON representation
Format dates in JavaScript using PHP syntax.
- Host: GitHub
- URL: https://github.com/2gbeh/php-date-format
- Owner: 2gbeh
- License: mit
- Created: 2024-01-06T22:31:26.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-07T21:44:31.000Z (over 2 years ago)
- Last Synced: 2025-10-19T18:42:14.169Z (9 months ago)
- Topics: npm-package
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@etugbeh/php-date-format
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# php-date-format
A node package for formatting dates in JavaScript using PHP syntax.
- No dependencies package
- No TypeScript support (yet)
- Use CommonJS import syntax
## Installation
```sh
npm install @etugbeh/php-date-format
```
## Usage
```javascript
const date_format = require("@etugbeh/php-date-format");
// Jan 7, 2024 (current date)
console.log(date_format());
// Tue, Sep 15, 1992
console.log(date_format("1992-09-15", "D, M j, Y"));
// 1970/01/01 12:00 AM
console.log(date_format("1970-01-01T00:00:00.000Z", "Y/m/d h:i A"));
```
## Documentation
https://www.w3schools.com/php/func_date_date_format.asp
The `date_format()` function returns a date formatted according to the specified format.
**Note**: This function does not use locales (all output is in English).
**Tip**: Also look at the `date()` function, which formats a local date/time.