function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Date.Today() Returning Wrong Date???

Can any one tell me why the code below would return the value


8/1/2012 8:00 PM
when the code was executed at


8/2/2012 3:38 PM EDT


The code was executed in the sandbox by a user in the EDT timezone.


LeadsToUpdate.add(new Lead(, Date_Demo__c =



The code updates date fields with the correct date, but provides the wrong date when populating a date/time field. Does that make sense to anyone? It seems odd.


It depends on the user timezone/Organizantim Time Zone settings....

Can you check this?


I looked at that and it's not a timezone thing. When I populated the date/time field with everything worked fine. However, produced the screwy results described above.


I've fixed the issue by using instead of when populating date/time fields. I have no idea, though, why the two methods produced different days.


One thing to note is will return Date and will return DateTime. This is why you are seeing different results for the two methods.