Java Date Now getCurrentDataInFormat(String pattern)

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

Description

get Current Data In Format

License

Open Source License

Declaration

public static String getCurrentDataInFormat(String pattern) 

Method Source Code

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

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

public class Main {
    public static String getCurrentDataInFormat(String pattern) {
        return getOffsetDateInFormat(0, pattern);
    }//from w ww . ja  va2 s.  com

    public static String getOffsetDateInFormat(int offsetDay, String pattern) {
        DateFormat dateFormat = new SimpleDateFormat(pattern);
        Calendar cal = Calendar.getInstance();
        if (offsetDay != 0) {
            cal.add(Calendar.DATE, offsetDay);
        }
        return dateFormat.format(cal.getTime());
    }
}

Related

  1. getCurrentAccurateDateTimeStringForPrint()
  2. getCurrentAgeByBirthdate(String brithday)
  3. getCurrentCacheTime()
  4. getCurrentCalendar()
  5. getCurrentCompactTime()
  6. getCurrentDataTimePrettyFilesystem()
  7. getCurrentDate()
  8. getCurrentDate()
  9. getCurrentDate()