Java Parse Time parseTimeString(String time)

Here you can find the source of parseTimeString(String time)

Description

parse Time String

License

Open Source License

Declaration

public static long parseTimeString(String time) 

Method Source Code

//package com.java2s;
/**//w ww .  j a  v a 2 s  .  c o  m
 * Project: play-jetty-server
 * 
 * File Created at 2014-4-12
 * $Id$
 * 
 * Copyright 2010 dianping.com.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Dianping Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with dianping.com.
 */

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    private static DateFormat formatter = new SimpleDateFormat("yyyy/MM/DD|HH:mm");

    public static long parseTimeString(String time) {
        Date date;
        try {
            date = formatter.parse(time);
            return date.getTime();
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return 0;
    }
}

Related

  1. parseTime(String timeString, TimeZone timeZone)
  2. parseTime(String token)
  3. parseTimeConfiguration(String time)
  4. parseTimeSpec(String[] spec)
  5. parseTimeStr(String timeStr)
  6. parseTimeString(String timeString)
  7. parseTimezoneOffset(String value)