Java Timestamp utcToTimestamp(String utcTimestamp)

Here you can find the source of utcToTimestamp(String utcTimestamp)

Description

utc To Timestamp

License

Open Source License

Declaration

public static Timestamp utcToTimestamp(String utcTimestamp)
            throws ParseException 

Method Source Code

//package com.java2s;
/**/*from  ww w. j a v a2 s .c o m*/
 * Copyright (c) 2009 University of Rochester
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the MIT/X11 license. The text of the
 * license can be found at http://www.opensource.org/licenses/mit-license.php and copy of the license can be found on the project
 * website http://www.extensiblecatalog.org/.
 *
 */

import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static Timestamp utcToTimestamp(String utcTimestamp)
            throws ParseException {
        Timestamp timestamp;
        Date d = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
                .parse(utcTimestamp);
        timestamp = new Timestamp(d.getTime());
        return timestamp;
    }
}

Related

  1. trunc(Timestamp dayTime, String trunc)
  2. truncateFractionalSeconds(Timestamp timestamp)
  3. truncateTimestamp(Timestamp timestamp, String period)
  4. truncNanos(Timestamp timestamp)
  5. unformattedFromTimestamp(java.sql.Timestamp t)
  6. weekNumber(Timestamp stamp, TimeZone timeZone, Locale locale)
  7. writeTimestamp(ByteBuffer logBuf, Timestamp time)
  8. writeTimestamp(Timestamp stamp, ObjectOutput out, long nullFlag)