![]() |
VOOZH | about |
The date-and-time.Date.compile() is a minimalist collection of functions for manipulating JS date and time module which is used to compile a format string for the parser.
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:
compile(formatString)
Parameters: This method takes the format string as the parameter.
Return Value: This method returns the formatted string date.
Example 1:
Run the index.js file using the following command:
node index.js
Output:
Formatted date and time : 1/1/1970
Example 2:
Run the index.js file using the following command:
node index.js
Output:
Formatted date and time: Sat Jul 03 2021 00:00:00 GMT+0530 (India Standard Time)