Reputation:
I have this string:
2020-11-20T14:00:00
How can i convert into
Friday, 11/20, 2:00 PM
Upvotes: 1
Views: 31
Reputation: 15223
This is the date format you wanted.
var param = { weekday: 'long', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', hour12: true };
var date_today = new Date();
console.log(date_today.toLocaleDateString("en-US", param));
Upvotes: 2
Reputation: 5496
You can use moment.js
to format the date time. Please check the example below:
var currentDate = "2020-11-20T14:00:00"
var formattedDate = moment(currentDate, "YYYY-MM-DDThh:mm:ss").format("dddd, MM/DD, hh:mm A")
console.log(formattedDate);
<script src="https://momentjs.com/downloads/moment.js"></script>
Upvotes: 2