Get Date from DateTime in Apex

Get Date from DateTime in Apex


Datetime dateWithTime = Datetime.now(); 
System.debug('dateWithTime ----- ' + dateWithTime); 
Date onlyDatefromDateTime = dateWithTime.Date();
System.debug( 'onlyDatefromDateTime ----- ' + String.valueOf(onlyDatefromDateTime));


Comments