Last active
August 29, 2015 14:24
-
-
Save wszdwp/da66daa12745f3dba3d4 to your computer and use it in GitHub Desktop.
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