Question:

How to get day from Datetime field

Oliver: 2 weeks ago

I want to extract my datetime value into different. I want to get day from the datetime value. eg: if datetime value is 2012/02/03 10:12:02 Tue. I want Tue from datetime. Is this possible.

Answer:
Ellie: 2 weeks ago

Datetime myDateTime = datetime.now();
System.debug(myDateTime.format('EEE'));

Outputs "Tue". Use "EEEE" for "Tuesday" (it will be always in English even if user's preferred language is different.