• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 93
  • Last Modified:

How to parse a date string to only show the data and truncate the time using javascript

Hi, how can I parse a string date to show only the date, so the date string looks like this:
08/01/2014 12:00:00 AM
MM/DD/YYY HH:MM:SS and I just want to show MM/DD/YYY
I've included moment.js but still can't get it to format the way I would like,
thanks for any help in advance...
1 Solution
Rainer JeschorCommented:
I did setup a small jsFiddle site:

As you can see,this will produce your desired format:
moment("08/01/2014 12:00:00 AM","DD/MM/YYYY hh:mm:ss A").format('L');

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now