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
PRepakaPRepaka 

how to convert date value to datetime value?

hi
 
Can u please tell me how to convert a date value to datetime value.
 
I want to convert startdate(date value) value to datetime value.
 
 
Best Answer chosen by Admin (Salesforce Developers) 
Drew1815Drew1815
Here is a snippet of Apex Code that shows how to take the Year, Month, and Day of a date object and convert it to a dateTime object.

Code:
 Date dToday = System.Today();
 Datetime dt = datetime.newInstance(dToday.year(), dToday.month(),dToday.day());
         

 



Message Edited by Drew1815 on 12-17-2008 08:21 AM