Here you can find the source of string2millis(String lexicalXSDDateTime)
Parameter | Description |
---|---|
lexicalXSDDateTime | - A string containing lexical representation of xsd:datetime |
public static long string2millis(String lexicalXSDDateTime)
//package com.java2s; /* //from w w w. ja v a 2s . c o m * SMART FP7 - Search engine for MultimediA enviRonment generated contenT * Webpage: http://smartfp7.eu * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * The Original Code is Copyright (c) 2012-2013 Athens Information Technology * All Rights Reserved * * Contributor: * Nikolaos Katsarakis nkat@ait.edu.gr */ public class Main { /** * Converts given string to milliseconds from Unix Epoch * * @param lexicalXSDDateTime * - A string containing lexical representation of xsd:datetime * @return Milliseconds since 1970-01-01 */ public static long string2millis(String lexicalXSDDateTime) { long res; try { res = javax.xml.bind.DatatypeConverter.parseDateTime(lexicalXSDDateTime).getTimeInMillis(); } catch (IllegalArgumentException e) { return -1; } return res; } }