You need to sign in to do that
Don't have an account?
rohitmarathe
How to get the name of the today's day in Apex class
Hi,
I am developing an apex class which is getting fired by a cron toolkit. In this Apex class I am checking for the name of the day for today(Example. Sunday, Monday etc.). I need to perform some database operations in today is the Wednesday. But I am not getting method in date object static and instance methods which will geive me the name of the day for specified date. Can anyone tell me the syntax of such method. Please note that it should be Apex class method.
Thanks for the help :)
I am developing an apex class which is getting fired by a cron toolkit. In this Apex class I am checking for the name of the day for today(Example. Sunday, Monday etc.). I need to perform some database operations in today is the Wednesday. But I am not getting method in date object static and instance methods which will geive me the name of the day for specified date. Can anyone tell me the syntax of such method. Please note that it should be Apex class method.
Thanks for the help :)
DateTime.now().format('EEEE')); for Wednesday
or
DateTime.now().format('E')); for Wed
You find more information about the formats here
You should be able to use Date.today() and date.toStartOfWeek() to figure out what day of the week (mon,tues,wed,..) it is.
You solved my problem.Thanks for the help :).
BoolEye solved the problem.
DateTime.now().format('EEEE')); for Wednesday
or
DateTime.now().format('E')); for Wed
You find more information about the formats here