Q: Has Salesforce broken away from datetime standards or did datetime standards change or get looser?
I ran this script in Execute Anon:
TimeZone tz =
UserInfo.getTimeZone();
System.debug(
'Display name: ' +
tz.getDisplayName());
System.debug(
'ID: ' +
tz.getID());
Datetime zGMT = Datetime.Now();
date dT = zGMT.date();
time tM = zGMT.time();
System.Debug('zGMT: '+zGMT);
System.Debug('zGMT.format : '+zGMT.format());
System.Debug('dT : '+dt);
System.Debug('tM : '+tM);
I got this result:
- 22:15:14:006 USER_DEBUG [3]|DEBUG|Display name: New Zealand Standard Time
- 22:15:14:006 USER_DEBUG [6]|DEBUG|ID: Pacific/Auckland
- 22:15:14:007 USER_DEBUG [12]|DEBUG|zGMT : 2017-01-15 09:15:14
- 22:15:14:007 USER_DEBUG [13]|DEBUG|zGMT.format : 15/01/2017 10:15 PM
- 22:15:14:007 USER_DEBUG [14]|DEBUG|dT : 2017-01-15 00:00:00
- 22:15:14:007 USER_DEBUG [15]|DEBUG|tM : 22:15:14.174Z
All of the results returned by Salesforce are correct except line 6.
If the timestamp is going to represent a timezone ALPHA then it should be an "M" for "Mike" or X for Xray as that is the TimeZone I am in, not sure which due to daylight savings time but definately not Z for Zulu or GMT
EXTRA- I remember about 6 years ago I could insert dates with this format and change the ALPHA at the end to represent my timezone and salesforce would adjust it to GMT for me. 2017-01-15T22:15:14.174M
Any ideas. I really feel like this is a bug.
system.debug
calls in your snippet.2017-01-15T22:15:14.174M
?