Some java Utility functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; | |
import java.util.Locale; | |
public class MyJavaUtility { | |
private static final String FORMAT1 = "EEEE, MMM d, yyyy hh:mm aaa"; //Wednesday, Jul 1, 2015 02:25 PM | |
//Date and Time in Java | |
public static String getTodaysDateAndTime(String format) { | |
DateFormat dateFormat = new SimpleDateFormat(format, Locale.US); | |
String dateTimeString = dateFormat.format(System.currentTimeMillis()); | |
return dateTimeString; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment