• Courses
  • Code Compiler
  • Discuss
  • Pricing
  • Teams
Menu
0

JavaScript Working with dates - how to change military time to normal timing (12hrs)

In JavaScript, when you get newDate(), it gets the military time (24hrs). How do you change it to normal timing (12 hrs)? https://code.sololearn.com/WljuSoBuCIW3/?ref=app

htmljavascriptchangewebbody24documenttiming12hrsgetdate()
10th Jun 2019, 11:13 PM
Ginfio
Ginfio - avatar
1 Answer
+ 1
date.toLocaleString('en-US') https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString https://code.sololearn.com/WuK38VeGfruw/?ref=app
11th Jun 2019, 12:52 AM
Gordon
Gordon - avatar

Often have questions like this?

Learn more efficiently, for free:

  • Introduction to Python

    7.1M learners

  • Introduction to Java

    4.7M learners

  • Introduction to C

    1.5M learners

  • Introduction to HTML

    7.5M learners

See all courses
Hot today
HTML
3 Votes
Functions in python
2 Votes
For Mobile app
0 Votes
What’s the One Thing That Helped You Learn Coding Faster?
2 Votes
How can you find whether a number is odd or even in a different way(other than (x%2==0))?
1 Votes
Answer please
0 Votes
I need advice
0 Votes
this query always result to be incorrect from Sorting Data lesson
1 Votes
I need advice
0 Votes
Html 5 document question
1 Votes