+ Start a Discussion
rohitmaratherohitmarathe 

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 :)
BoolsEyeBoolsEye

DateTime.now().format('EEEE')); for Wednesday

or

DateTime.now().format('E')); for Wed

You find more information about the formats here

devNut!devNut!
I don't see anything in the apex language reference about getting the name of the day of the week.

You should be able to use  Date.today() and date.toStartOfWeek() to figure out what day of the week (mon,tues,wed,..) it is.
rohitmaratherohitmarathe
Hi,
You solved my problem.Thanks for the help :).
rohitmaratherohitmarathe

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