$(document).ready(function() { var value = $("#unixtime").val();
There is a strict mode and a mode of forgiveness .
Although strict mode works better in most situations, forgiving mode can be very useful when the format of the string currently being transmitted may be different.
In a later release, the parser will use strict mode by default. Strict mode requires input at the moment to exactly match the specified format, including delimiters. Strict mode is set by passing true as the third parameter of the moment function.
A common scenario where a pardon mode is useful is when a third-party API provides a date, and the date format for this API may change. Suppose the API starts by sending dates in the format "YYYY-MM-DD", and then changes to the format "MM / DD / YYYY".
In strict mode, the following code results in the display of "Invalid date":
moment('01/12/2016', 'YYYY-MM-DD', true).format() "Invalid date"
In forgiveness mode using a format string, you get the wrong date:
moment('01/12/2016', 'YYYY-MM-DD').format() "2001-12-20T00:00:00-06:00"
another way would be
$(document).ready(function() { var value = $("#unixtime").val();
devon kassian Apr 05 '19 at 17:45 2019-04-05 17:45
source share