This came up on twitter from @britishboyindc:
Why does this return 'Wed'?
Date myDt = system.today(); DateTime myDtTime = (DateTime) myDt; system.debug(myDtTime.format('E'));
For a user with the Pacific Standard Time
TimeZone this is currently returning 'Wed' when it is Thursday.
I've also found the following assertion fails:
DateTime myDateTime = System.today(); System.assertEquals(myDateTime.day(), System.today().day());
System.AssertException: Assertion Failed: Expected: 6, Actual: 7
Why does assigning the DateTime to a variable change the value?