0.0.4 • Published 3 years ago
date-to-string-js v0.0.4
dateToStringJS
DateToString is a zero dependency package, it take's two arguments, a date object and generic string that rappresent the desired format. Return a string with the same format as the second argument but filled with the Date values.
Installation
npm i date-to-string-js
Usage
const { dateToString } = require('date-to-string-js');
const myDate = new Date();
dateToString(myDate, 'DD/MM/YY'); // return 25/11/20
dateToString(myDate, 'DD/MM/YYYY'); // return 25/11/2020
dateToString(myDate, 'MM/DD/YYYY'); // return 11/25/2020
dateToString(myDate, 'DD-MM-YYYY hh:mm'); // return 25-11-2020 21:42
dateToString(myDate, 'hh:mm:ss'); // return 21:42:54