Different business processes may demand different DateTime formats.
Check out the patterns of DateTime available and pick the appropriate format 🙂

d >> Represents the day of the month i.e 1,2,16 or 31

dd >> Represents the day of the month i.e 01,05,14 or 31

ddd >> Represents the abbreviated name of the day i.e Mon, Tues or Wed

dddd> Represents the full name of the day i.e Monday, Tuesday or Wednesday

M >> Represents the month number i.e 1,5 or 12

MM >> Represents the month number with leading zero i.e 04,09 or 12

MMM >>Represents the abbreviated month Name i.e Jan, May or Dec

MMMM >> Represents the full month name i.e. January, June or December

y >> Represents the year i.e. 2019 as 19

yy >> Represents the year with a leading zero i.e. 2019 as 019

yyy >> Represents the year i.e 2019

yyyy >> Represents the year i.e 2019

h >> Represents the 12hour clock i.e 4,11 or 2

hh >> Represents the 12hour clock with a leading 0 i.e. 04,05 or 12

H >> Represents the 24hour clock i.e 13,18 or 22

HH >> Represents the 24hour clock with a leading 0 i.e. 04,09 or 22

m >> Represents the minutes i.e. 12,40 or 56

mm >> Represents the minutes with a leading zero i.e 04,09 or 23

s >> Represents the seconds i.e 9,35 or 40

ss >> Represents the seconds with leading zero i.e. 04,09 or 35
Hope it has helped you…
[…] Note: In case you’re trying to convert DateTime Datatype to String, Click here […]