Java Hour Format formatStringTimeToLong(String timeLine)

Here you can find the source of formatStringTimeToLong(String timeLine)

Description

format String Time To Long

License

Apache License

Declaration

public static long formatStringTimeToLong(String timeLine) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Main {
    public static final String FROMAT = "yyyy-MM-dd HH:mm:ss";

    public static long formatStringTimeToLong(String timeLine) {
        long time = -1L;
        SimpleDateFormat format = new SimpleDateFormat(FROMAT);
        try {//  w ww . j a va 2s  .com
            time = format.parse(timeLine).getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return time;
    }
}

Related

  1. formatSingleFractionHours(Double updatedHours)
  2. formatSQL(Date date)
  3. formatSqlDateTime(Date value)
  4. formatSSLValid(Date validFrom, Date validTo)
  5. formatStringTime(String dateTime)
  6. formatStrToDate(String strDate, int format)
  7. formatStrToDate(String value, String pattern)
  8. formattedDate()
  9. formattedDate(java.util.Date date, String formatString)