![]() |
VOOZH | about |
The date-and-time.Date.format() is a minimalist collection of functions for manipulating JS date and time module which is used to format the date according to a certain pattern.
Required Module: Install the module by npm or used it locally.
npm install date-and-time --save<script src="/path/to/date-and-time.min.js"></script>Syntax:
format(dateObj, formatString[, utc])Parameters: This method takes the following arguments as parameters:
Return Value: This method returns formatted date and time.
Example 1:
Run the index.js file using the following command:
node index.jsOutput:
current date and time : 2021/03/07 12:13:46Example 2:
Run the index.js file using the following command:
node index.jsOutput:
date and time : 1995/12/17 03:24:00