Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. String DateStr="2012-05-31T13:48:04Z";
  2. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
  3. Date d=sdf.parse(DateStr);
  4. System.out.println(d.getTime());
  5.  
  6. Instant.parse( "2012-05-31T13:48:04Z" )
  7. .toEpochMilli()
  8. / 1_000L
  9.  
  10. Instant instant = Instant.parse( "2012-05-31T13:48:04Z" ) ;
  11.  
  12. long millisSinceEpoch = instant.toEpochMilli() ;
  13.  
  14. long secondsSinceEpoch = ( millisSinceEpoch / 1_000L ) ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement