[progress Communities] [progress Openedge Abl] Forum Post: Re: Return Date From Date Time Field

Status
Not open for further replies.
M

Mohammed Siraj

Guest
In your above stated approach, Date details like hours, minutes & seconds are lost in parsing and instantiating a new Date object. We should ideally use the following Date constructor to instantiate new Date object from individual Date units: new Date(year, month[, day[, hour[, minutes[, seconds[, milliseconds]]]]]); A more simpler approach to parse date string literal into Date object is: new Date('{!createdAt#js}'); //do not use iso format, JS Date.parse function will not be able to parse it correctly Modified example: function parseDate(str) { return new Date(str); } var dt = new Date('{!createdAt#js}'); // or var dt=parseDate('{!createdAt#js}');

Continue reading...
 
Status
Not open for further replies.
Top