Sidebar

Formatting current date to desired format

0 votes
260 views
asked Feb 16, 2018 by aritra-k-6337 (380 points)
retagged Feb 16, 2018 by amanda-w-3695
Hi Team,

Can someone please help me with a function which can covert the current date & Time (in EST) to the below expected date time format:

Expected Format: Friday, February 15, 2018 13:34:37 PM

I have tried to use the below but it did not produce the desired output.

var DateTime = qie.formatDate('yyyy-MM-dd HH:mm:ss', qie.getSystemDate()); // Output: 2018-02-16 06:37:54"

I would really appreciate if someone can help me with this.

Thanks,

Aritra

1 Answer

+2 votes
 
Best answer

The code below will give you the expected format you were looking for. This will display the full day name, full month name as well as AM/PM. 

var dateTime = qie.formatDate('EEEE, MMMM d,yyyy HH:mm:ss aaa', qie.getSystemDate());

answered Feb 16, 2018 by amanda-w-3695 (4,220 points)
selected Feb 19, 2018 by aritra-k-6337
...