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
IoniaCorpIoniaCorp 

How to get the day of the certain date?

Is there a way to get the day(sunday,Monday.....) from the given date.
urgent help needed. any idea will be appreciated.
BritishBoyinDCBritishBoyinDC
I think a creative use of either of these functions might work - see the apex reference for more info:

toStartOfWeek - Returns the start of the week for the Date that called the method, depending on the context user's locale. For example, the start of a week is Sunday in the United States locale, and Monday in European locales. For example:

format method for datetime - choose the right format, and this would include you return the day of the week I think
AnyaAnya

I am looking for the exact same thing. We have a custom field in Opportunities called Service Date, and would like to have a custom formula field that calculates the day of the week that Service Date falls on.

 

Anya

dmchengdmcheng
Try the format method of the DateTime object.  See p. 188 in the latest Apex Reference Manual, and click go to the java.sun.com link to see details on using the format string.