Java String to Time getTime(String pattern)

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

Description

get Time

License

Open Source License

Declaration

public static String getTime(String pattern) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the NCI * style
 * license a copy of which has been included with this distribution in * the
 * LICENSE.txt file. * */*from  ww w. j a  v a  2 s  .c om*/
 ******************************************************************************/

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String getTime(String pattern) {
        Date now = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(now);
    }

    public static String getTime() {
        Long reVar = new Long(new Date().getTime());

        return reVar.toString();
    }
}

Related

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