Here you can find the source of ISO8601ToSeconds(String iso8601)
Parameter | Description |
---|---|
iso8601 | an IS8601 timestamp |
Parameter | Description |
---|---|
ParseException | if the timestamp is not valid |
public static double ISO8601ToSeconds(String iso8601) throws ParseException
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; public class Main { /**/*w ww . j a v a2s . com*/ * A date format for IS8601 date and time representation. This representation * is to the millisecond in UTC time. */ private static final SimpleDateFormat ISO8601_DATE_FORMAT = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); /** * Converts an ISO8601 timestamp into a RBNB timestamp. * * @param iso8601 an IS8601 timestamp * @return a RBNB timestamp * @throws ParseException if the timestamp is not valid */ public static double ISO8601ToSeconds(String iso8601) throws ParseException { return ISO8601_DATE_FORMAT.parse(iso8601).getTime() / 1000d; } }