8 Mar 2017

Different types of Date format that you can set...


Different types of Date format that you can set...


FormatMeaning/DescriptionExample1Example2
yA year with at least 1 digit.175 AD → “175”2016 AD → “2016”
yyA year with exactly 2 digits.5 AD → “05”2016 AD → “16”
yyyA year with at least 3 digits.5 AD → “005”2016 AD → “2016”
yyyyA year with at least 4 digits.5 AD → “0005”2016 AD → “2016”
MA month with at least 1 digit.July → “7”"November" → "11"
MMA month with at least 2 digits.July → “07”"November" → "11"
MMMThree letter month abbreviation.July → “Jul”"November" → "Nov"
MMMMFull name of month.July → “July”"November" → "November"
MMMMMOne letter month abbreviation(Jan,June,July all will have 'J').July → “J”"November" → "N"
dDay with at least one digit.8 → “8”29 → “29”
ddDay with at least two digits.8 → “08”29 → “29”
“E”, “EE”, or”EEE”3 letter day abbreviation of day name.Monday → “Mon”Thursday → “Thu”
EEEEFull Day name.Monday → “Monday”Thursday → “Thursday”
EEEEE1 letter day abbreviation of day name.(Thu and Tue will be 'T')Monday → “M”Thursday → “T”
EEEEEE2 letter day abbreviation of day name.Monday → “Mo”Thursday → “Th”
aPeriod of day (AM/PM).10 PM → “PM”2 AM → “AM”
hA 1-12 based hour with at least 1 digit.10 PM → “10”2 AM → “2”
hhA 1-12 based hour with at least 2 digits.10 PM → “10”2 AM → “02”
HA 0-23 based hour with at least 1 digit.10 PM → “14”2 AM → “2”
HHA 0-23 based hour with at least 2 digits.10 PM → “14”2 AM → “02”
mA minute with at least 1 digit.7 → “7”29 → “29”
mmA minute with at least 2 digits.7 → “07”29 → “29”
sA second with at least 1 digit.7 → “7”29 → “29”
ssA second with at least 2 digits.7 → “07”29 → “29”
There are many more, for getting different time based on zone(z), for getting time with millisecond details(S), etc.

No comments:

Post a Comment

Recent Posts

Codable demo

Link: https://www.dropbox.com/s/kw7c1kgv1628bh7/codableDemo.zip?dl=0