Get Day of Today
date intNoofDays ;
intNoofDays = system.today();
Output: intNoofDays__ 2014-09-25 00:00:00
system.debug('intNoofDays__'+intNoofDays);
Datetime dt = DateTime.newInstance(intNoofDays,
Time.newInstance(0, 0, 0, 0));
Output: dt___2014-09-24 18:30:00
system.debug('dt___'+dt);
String strTodayDayName = dt.format('EEEE');
System.debug('Day : ' + strTodayDayName);
Output: Day : Thursday
intNoofDays = system.today();
Output: intNoofDays__ 2014-09-25 00:00:00
system.debug('intNoofDays__'+intNoofDays);
Datetime dt = DateTime.newInstance(intNoofDays,
Time.newInstance(0, 0, 0, 0));
Output: dt___2014-09-24 18:30:00
system.debug('dt___'+dt);
String strTodayDayName = dt.format('EEEE');
System.debug('Day : ' + strTodayDayName);
Output: Day : Thursday
Comments
Post a Comment