×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Hani Ibrahim
Added: Jan 30, 2017 5:23 PM
Views: 16
ISO 8601 timestamp (e.g. 2017-01-01T14:10:23+0100), Java 6 compatible
  1.     private static String getCurrentIsoTimestamp(){
  2.         TimeZone tz = TimeZone.getDefault();
  3.         DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
  4.         df.setTimeZone(tz);
  5.         return df.format(new Date()); // ISO 8601 Timestamp format
  6.     }