Use:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Use MM
for month, mm
for minutes as stated by documentation…
If you want to print a Date
in a specific format, you should use:
sdf.format(birthday)
or another SimpleDateFormat
if you want to pring it in a different format…
More Related Contents:
- Date object SimpleDateFormat not parsing timestamp string correctly in Java (Android) environment
- String-Date conversion with nanoseconds
- How to Parse Date from GMT TimeZone to IST TimeZone and Vice Versa in android
- Simple Date format returns Wrong date intermittently [duplicate]
- Creating new Android (Java ) file in Existing Android package [closed]
- I'm trying to create a basic android application on eclipse [closed]
- Advanced AlarmManager situation [closed]
- Handler as a method parameter
- How to format a String number into a US phone number format
- How to launch an Activity from another Application in Android
- Java 7 language features with Android
- How to add a recyclerView inside another recyclerView
- Android JSONObject – How can I loop through a flat JSON object to get each key and value
- How can I print an image on a Bluetooth printer in Android?
- Unable to resolve host “” No address associated with host name [closed]
- How to set background color of an Activity to white programmatically?
- Android Studio – No JVM Installation found
- Sort data to RecyclerView based on latest date from Firebase
- Error building AAB – Flutter (Android) – Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available
- Broadcast Receiver as inner class in Android
- Print array without brackets and commas
- Where is main() in Android?
- Where to stop/destroy threads in Android Service class?
- How to programmatically grant the “draw over other apps” permission in android?
- How to test if a JSONObject is null or doesn’t exist
- How to convert JSONArray to List with Gson?
- Transparent status bar – before Android 4.4 (KitKat)
- stringByEvaluatingJavascriptFromString (iOS method, what is Android equivalent?)
- java.lang.SecurityException: attempting to read gservices without permission
- How to execute web request in its own thread?