Last active
November 11, 2020 10:33
-
-
Save DaChelimo/26b56d643e87176c5b04860f9d593a46 to your computer and use it in GitHub Desktop.
Patterns for SimpleDateFormat for Java & Kotlin
This file contains hidden or 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
### SimpleDateFormat Patterns | |
*Year* | |
// yyyy or YYYY - Year | |
*Month* | |
MM - Month of the year (eg. 11) | |
MMM - Month of the year (eg. Nov) | |
MMMM - Month of the year (eg. November) | |
*Day* | |
EE- Day of the week (eg. Wed) | |
EEEE - Day of the week (eg. Wednesday) | |
dd - Day of the Month (eg. 11) | |
DD - Day of the year (eg. 316) | |
*Hour* | |
hh - Hour | |
mm - Minute | |
ss - Seconds | |
SSS - MilliSeconds | |
**Full example** | |
SimpleDateFormat("dd/MM/yyyy (DD) hh:mm:ss").format(Date()) prints 11/11/2020 (316) 09:26:22:476 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment