You need to sign in to do that
Don't have an account?
System.Today() conflict when logging in as another user
Hi All,
Just recently I came across one strange issue. I'm still investigating it. Posting the problem here in case anyone has faced the same issue earlier, or if I'm missing anything.
I'm an sys admin in GMT+5:30 timezone (India) and I've logged in on behalf of another user with GMT - 7:00 (US) and created a record (The logged-in users current date is 2016-06-14). The object field I'm checking is a DateTime field (holding the created datetime) and I noticed that when I extract the date part (using the <DateTimeField>.date() ) method, the date is "2016-06-13 00:00:00". However, when I'm simply printing out the dateTime field in debug (minus the .date() part), I'm getting "2016-06-14 00:00:00".
Due to this issue, the code is not working properly and I would appreciate if anyone can help me with this. I'm still investigating this and if anyone has faced similiar issues before, would really appreciate the inputs.
Regards,
Ayan
Just recently I came across one strange issue. I'm still investigating it. Posting the problem here in case anyone has faced the same issue earlier, or if I'm missing anything.
I'm an sys admin in GMT+5:30 timezone (India) and I've logged in on behalf of another user with GMT - 7:00 (US) and created a record (The logged-in users current date is 2016-06-14). The object field I'm checking is a DateTime field (holding the created datetime) and I noticed that when I extract the date part (using the <DateTimeField>.date() ) method, the date is "2016-06-13 00:00:00". However, when I'm simply printing out the dateTime field in debug (minus the .date() part), I'm getting "2016-06-14 00:00:00".
Due to this issue, the code is not working properly and I would appreciate if anyone can help me with this. I'm still investigating this and if anyone has faced similiar issues before, would really appreciate the inputs.
Regards,
Ayan
You needs to convert it into GMT time. For safer side also consider DayLight savings. May be following snippet will help you: Please let me know if this helps you.
Thanks,
Amit