Java Millisecond Convert getTimeInMillisFromNicsDateString(String dateString)

Here you can find the source of getTimeInMillisFromNicsDateString(String dateString)

Description

get Time In Millis From Nics Date String

License

Open Source License

Declaration

public static Long getTimeInMillisFromNicsDateString(String dateString) 

Method Source Code


//package com.java2s;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import org.joda.time.DateTime;

public class Main {
    public static Long getTimeInMillisFromNicsDateString(String dateString) {
        Long ret = null;//  ww  w.  j  a va  2  s .co m
        DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
        Date date;
        try {
            date = (Date) formatter.parse(dateString);
            DateTime dt = new DateTime(date);
            ret = dt.getMillis();
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return ret;
    }
}

Related

  1. getStringFromMillis(long timestamp)
  2. getTime(long millis)
  3. getTime(long time, boolean withMilliseconds)
  4. getTimeByMillis(long now)
  5. getTimeFromMillisAsNICSDate(long timeInMillis)
  6. getTimeMillis(String dateStr)
  7. getTimeMillis(String time)
  8. getTimestamp(long milliseconds)
  9. getTimestampMillis(Locale locale)