I'm using the DateTime object in my apex code.

In the documentation of the DateTime class I saw there are methods to return day-of-month, day-of-year but there is no method to return day-of-week what I need.

I need to know which day-of-week is represented by this object?


The only practical way to get this is to use the format method:

DateTime dt = DateTime.now();
String dayOfWeek = dt.format('EEEE');
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.