Skip to main content

Posts

Showing posts from January, 2019

Parsing ISO 8601 timestamps with Deluge

ISO 8601 is a commonly used standard for timestamps. Here's a snippet the Zoho team gave me to make parsing them easier: timestamp_str = "2015-01-1T15:30:54+05:00";  timestamp_time = dateString.toTime("yyyy-MM-dd'T'HH:mm:ss","GMT+" + timestamp_str.getsuffix("+")); // convert to Australia/Sydney timezone timestamp_in_sydney = timestamp_time.toString("yyyy-MM-dd HH:mm:ss","GMT+10:00"); info timestamp_in_sydney; // outputs  2015-01-01 20:30:54 (5 hrs later than original timestamp as expected due to 5hr difference between time zones)