Java String to Time getTime(String parrten)

Here you can find the source of getTime(String parrten)

Description

get Time

License

Apache License

Declaration

public static String getTime(String parrten) 

Method Source Code


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

import java.text.SimpleDateFormat;

public class Main {

    public static String getTime(String parrten) {
        String timestr;//ww  w .j a va2  s.  c om
        if (parrten == null || parrten.equals("")) {
            parrten = "yyyyMMddHHmmss";
        }
        java.text.SimpleDateFormat sdf = new SimpleDateFormat(parrten);
        java.util.Date cday = new java.util.Date();
        timestr = sdf.format(cday);
        return timestr;
    }
}

Related

  1. getSystemTime(String pattern)
  2. getTime(String date)
  3. getTime(String date, String pattern)
  4. getTime(String dateTimeString)
  5. getTime(String file)
  6. getTime(String pattern)
  7. getTime(String pattern)
  8. getTime(String s)
  9. getTime(String sDateTime, String eDateTime)