Android Calendar Format getCurrentDateString(String dateFormat)

Here you can find the source of getCurrentDateString(String dateFormat)

Description

get Current Date String

License

Apache License

Declaration

public static String getCurrentDateString(String dateFormat) 

Method Source Code

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

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

import java.util.TimeZone;

public class Main {

    public static String getCurrentDateString(String dateFormat) {
        Calendar cal = Calendar.getInstance(TimeZone.getDefault());
        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
        sdf.setTimeZone(TimeZone.getDefault());

        return sdf.format(cal.getTime());
    }// ww  w.  j a  v a 2 s .c  o  m
}

Related

  1. format(Calendar cal, String format, Locale locale)
  2. getCalendarFromDateString(String dateString, String format, Locale locale)
  3. getFormatedDate(Calendar c, String format)
  4. string2calendar(String s, String formatString)
  5. toSimpleDate(Calendar calendar, String format)
  6. getAsString(Calendar date)
  7. formatCalendar(Calendar calendar)
  8. formatCalendar(Calendar calendar, String pattern)
  9. formatDateTime(Calendar dateTime)