0

I'm an Android developer and i'm having an issue about getting time with .Net "since 12:00:00 midnight, January 1, 0001 (0:00:00 UTC on January 1, 0001, in the Gregorian calendar)".

How can i convert java getTimeInMillis() to .Net time value? Thank in advance

Steve Luck
  • 173
  • 1
  • 12

1 Answers1

1
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //change your formate accordingly
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));

String inputString = "00:01:30.500";

Date date = sdf.parse("1970-01-01 " + inputString);
System.out.println("in milliseconds: " + date.getTime());  
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Arth Tilva
  • 2,496
  • 22
  • 40
  • Thank for answer my question :) I made it works by add the milliseconds from 0001 year to 1970 to current milliseconds, then done – Steve Luck Jul 15 '15 at 02:52