It's useful to know that this is the same format used by the Windows GetDateFormat function. You use apostrophe's to indicate some literal you want inserted into the resulting string.
More documentation of the string formatting codes can be found on:
In your string it is indiating that it literally wants to add hyphens, colons, and the T characters:
yyyy '-'
MM '-'
dd 'T'
HH ':'
mm ':'
ss
In general you don't want to construct dates/times with literally a hyphens (-
) or colons (:
), or even slashes (/
). Because those are wrong for cultures that don't use slashes and colons to construct dates/times:
- 10/22/2019 10∶19∶54 ᴀᴍ
- 10:19:54
- 2019.10.22 10:19:54
- 2019-10-22 10.19.54
- 2019-10-22 10:19:54
- 2019-10-22 10:19:54 AM
- 2019-10-22 ཆུ་ཚོད་10:19:54 སྔ་ཆ་
- 2019-10-22 오전 10:19:54
- 2019 10:19:54
- 10:19:54
- 22.10.19 10:19:54
- 22.10.19 ý. 10:19:54
- 22.10.2019 10.19.54
- 22.10.2019 10:19:54
- 22.10.2019 10:19:54 p.d.
- 22.10.2019 г. 10:19:54
- 22.10.2019. 10:19:54
- 22-10-19 10.19.54
- 22-10-19 10.19.54 AM
- 22-10-19 10:19:54
- 22-10-19 ਸਵੇਰ 10:19:54
- 22-10-2019 10:19:54
- 22-10-2019 ৰাতিপু 10:19:54
- 22-окт. 19 10:19:54
- 23/02/41 10:19:54 ص
- 30/07/1398 10:19:54 ق.ظ
What you would want to do, if you want to indicate:
- "here is where you should put the date separator"
- "here is where you should put the time separator"
Is use the special:
- date separator replacement character (/)
- time separator replacement character (:)
And construct a format such as:
dd/yyyy/MM ss:HH:mm
I don't know what business need one might have to show a date as:
- 22/2019/10 37:10:24
- 22-2019-10 37∶10∶24
- 22//2019//10 37::10::24
- 10 37∶10∶24
But this way the localizer will insert the culture's correct date and time separators.
Whereas if you literally asked for /
, -
, or :
:
- dd
'/'
yyyy '/'
MM ss ':'
HH ':'
mm
You will literally get:
rather than: