Java Time Format getTimeAsString(String timeFormatAsString)

Here you can find the source of getTimeAsString(String timeFormatAsString)

Description

get Time As String

License

Open Source License

Declaration

public static String getTimeAsString(String timeFormatAsString) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    public static String getTimeAsString(String timeFormatAsString) {

        DateFormat timeFormat = new SimpleDateFormat(timeFormatAsString);
        Calendar calendar = Calendar.getInstance();

        return timeFormat.format(calendar.getTime());

    }//from www.  j  a  v a2s .  c  o m
}

Related

  1. getTime(String format)
  2. getTime(String format, String date)
  3. getTime(String timeFormat)
  4. getTimeAfter(int field, int amount, String formatStr)
  5. getTimeAsString(final Date date, final String format)
  6. getTimeByDate(Date date, String timeFormat)
  7. getTimeByFormat(Date date, String format)
  8. getTimeCount(String from, String to, String format)
  9. getTimeCount(String from, String to, String format)