0

I am storing time in milliseconds into UTC format and while showing it, and later I am converting back into the user timezone.

But I'm getting date one day less than what I have stored in the Db.

DavidPostill
  • 7,734
  • 9
  • 41
  • 60
  • possible duplicate of [Converting date from UTC to EST in Java?](http://stackoverflow.com/questions/8559165/converting-date-from-utc-to-est-in-java) – timrau Apr 17 '15 at 03:49
  • Can you post the code you have? – Ethaan Apr 17 '15 at 04:15
  • public static long getDateInMiliseconds(String dateStr) { long dateInMiliseconds = 0; String defaultTimeZone = "UTC"; String dateFormatStr =""MM-dd-yyyy"; DateFormat formatter = new SimpleDateFormat(dateFormatStr); formatter.setTimeZone(TimeZone.getTimeZone(defaultTimeZone)); Date date = formatter.parse(dateStr); dateInMiliseconds = date.getTime(); return dateInMiliseconds; } i am using this to get date in millis from date. – manju Mahandule Apr 20 '15 at 10:55

0 Answers0