You need to sign in to do that
Don't have an account?

date issue
Hi All,
I am running this below code:
Date d=Date.today();
system.debug('todyas date:'+d);
Datetime dt = (DateTime)d;
String dayOfWeek = dt.format('EEEE');
system.debug('day Of Week :'+dayOfWeek);
And got the debug log:
22:01:52:002 USER_DEBUG [2]|DEBUG|todyas date:2019-08-23 00:00:00
22:01:52:002 USER_DEBUG [5]|DEBUG|day Of Week :Thursday

but 23rd August 2019 is Friday.
Can any one tell me what is the issue?
I am running this below code:
Date d=Date.today();
system.debug('todyas date:'+d);
Datetime dt = (DateTime)d;
String dayOfWeek = dt.format('EEEE');
system.debug('day Of Week :'+dayOfWeek);
And got the debug log:
22:01:52:002 USER_DEBUG [2]|DEBUG|todyas date:2019-08-23 00:00:00
22:01:52:002 USER_DEBUG [5]|DEBUG|day Of Week :Thursday
but 23rd August 2019 is Friday.
Can any one tell me what is the issue?
More answer can be found here (https://salesforce.stackexchange.com/questions/99098/date-formateeee-doesnt-give-day-of-week)
Please take variable 'd' as datetime type instead of date and then run your code. For ex: I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
www.ajaydubedi.com