Java Millisecond Current Get getMillins(String yyyyMMddHHmmss)

Here you can find the source of getMillins(String yyyyMMddHHmmss)

Description

get Millins

License

Open Source License

Declaration

public static long getMillins(String yyyyMMddHHmmss) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

public class Main {

    public static long getMillins(String yyyyMMddHHmmss) {
        long d = 0;
        try {/*from  w  w w.ja v a2s  . co m*/
            java.util.Date date = new java.util.Date();
            java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyyMMddhhmmss");
            date = formatter.parse(yyyyMMddHHmmss);
            java.util.Calendar c = java.util.Calendar.getInstance();
            c.setTime(date);
            d = c.getTimeInMillis();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return d;
    }

    public static String getMillins(long yyyyMMddHHmmss) {
        String d = new String();
        try {
            java.util.Date date = new java.util.Date();
            date.setTime(yyyyMMddHHmmss);
            d = new SimpleDateFormat("yyyyMMddHHmmss").format(date);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return d;
    }
}

Related

  1. getCurrentMillis()
  2. getCurrentMillisecond()
  3. getCurrentMillisecondString()
  4. getCurrentMillisecondZeroFillString()
  5. getCurrentTimeMillisStr()
  6. getMillisDurationString(long millis)
  7. getMillisec_old(String isoDate)
  8. getMillisecondStamp(Date date)
  9. getMilliSecondToTomorrow(Date date)