-1

How do I get the date and time from the given date string 2014-08-13T17:48:00:000+0530? I want to get the date and time as 13 aug 2014 05:48:00 PM.

Flimzy
  • 68,325
  • 15
  • 126
  • 165
  • What have you tried so far? Stack Overflow is about getting help after a legitimate attempt has been made to solve the problem, so if you have made an attempt, you want to put it in your question. What language are you using, `Java` or `Javascript` (they are not the same language)? It might also help to give a little bit of context as to what you are doing this for. – Nick Meyer Aug 16 '14 at 18:50
  • Also, exactly what format do you want the date and time in? And what result are you expecting to convert `"2014-08-13T17:48:00:000+0530"` into? – Nick Meyer Aug 16 '14 at 18:55

1 Answers1

1

If you are using Java then you can format the Date & Time with SimpleDateFormat.

SimpleDateFormat dateFromat= new SimpleDateFormat("Expected Format");
dateFromat.format("Date to be format");

Look at these for more examples on conversion in Java :-

  1. Display current time in 12 hour format with AM/PM - stackoverflow
  2. How can I change date from 24-hours format to 12-hours format (am/pm) - Stackoverflow

If you want to do the Date/Time conversion with JavaScript then fetch hours & minutes from date & check whether it is greater than 12 hours or not.

var ampm = hours >= 12 ? 'pm' : 'am';

For more on conversion with JavaScript have a look at this :-

  1. How do you display javascript datetime in 12 hour AM/PM - Stackoverflow
  2. Display Time in 12 Hour Format in JavaScript
Community
  • 1
  • 1
OO7
  • 2,779
  • 1
  • 17
  • 31