curts-date-formatter
v1.1.0
Published
Curts Date Formatter is a simple npm package that provides a function to format dates according to different formats.
Downloads
4
Readme
Curts Date Formatter
Curts Date Formatter is a simple npm package that provides a function to format dates according to different formats.
Features
- Format dates in different formats: 'YYYY-MM-DD', 'MM/DD/YYYY', 'DD/MM/YYYY'
- Include time in the formatted date
- Specify custom delimiters for date components
Installation
To install Curts Date Formatter, use npm:
npm install curts-date-formatter
const formatDate = require('curts-date-formatter');
// Format date using default format (YYYY-MM-DD)
const formattedDate1 = formatDate(new Date());
console.log(formattedDate1);
// Format date using custom format (MM/DD/YYYY)
const formattedDate2 = formatDate(new Date(), 'MM/DD/YYYY');
console.log(formattedDate2);
// Format date using another custom format (DD/MM/YYYY)
const formattedDate3 = formatDate(new Date(), 'DD/MM/YYYY');
console.log(formattedDate3);
// Format date with time
const formattedDate4 = formatDate(new Date(), 'YYYY-MM-DD', true);
console.log(formattedDate4);
// Format date with custom delimiter
const formattedDate5 = formatDate(new Date(), 'YYYY-MM-DD', false, '.');
console.log(formattedDate5);