Skip to content

Instantly share code, notes, and snippets.

@wszdwp wszdwp/MyJavaUtility.java
Last active Aug 29, 2015

Embed
What would you like to do?
Some java Utility functions
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
You can’t perform that action at this time.