fcf.formatDate() function
Package: fcf-framework-core
File: fcf-framework-core:fcf.js
Available from version: 2.0.2
Converts a Date object to a string representation
Arguments
- The Date object to be converted to a string representation
- A string indicating the format of the source string
You can use the following characters in the format string
Y - Year (1000-9999)
m - Month (01-12)
d - Day (01-31)
H - Hour (00-23)
h - Hour (01-12)
a - am, pm
A - AM, PM
i - Minutes (00-59)
s - Seconds (00-59)
v - Milliseconds (000-999)
Any other character declares its mandatory presence
\ is used to escape special characters.
- Time zone offset from current value ((new Date()).getTimezoneOffset(), if value is false , UTC time is used.
Result
- A string containing the date and time in the given format
Example: Function application
let date = fcf.formatDate("1971-02-01T09:01:01");
console.log(date);
Output:
1971-02-01 09:01:01.000