I wanted to return current date and time in August 13, 2019 03:54 PM format using Java script.Could someone help me in achieving this because I am not able to find the appropriate js to achieve this format.
Thanks in advance,
Try this (format string syntax is explained here):
var result = dateFormat(new Date(), "MMMMM d, yyyy hh:mm a");
Note that formatting date/time on the server side is almost always a bad idea, because for doing so it uses server time zone (typically GMT). In most cases you should rather format it in a mashup (widgets like Grid, Value Display and others support time formatting on the client side in a similar fashion, thus automatically adjusting to the user's time zone). Few cases when you need to format date/time on the server side include sending emails, SMS, etc. -- but in this case please double-check the timezones and make sure you handle things like DST.
If the responses has answered your question, please mark it as an Accepted Solution for the benefit of others who may have the same question in the future.
Thank you for your contributions to the PTC Community.