+ Start a Discussion
sdbsdb 

Convert a Date to a Datetime

Is it possible to convert a Date field to a Datetime value in a formula field? 

Best Answer chosen by Admin (Salesforce Developers) 
kcpluspluskcplusplus

You can, it really depends on what you are trying to do though. If you are simply trying to enter a static time with a date, it is fairly simple using the DATETIMEVALUE, the TEXT function and concatenating the static date on the end of a date. If you are trying to use dynamic times it can be a little more difficult, as converting data types and time zones then become a factor. I find it much easier to do something like this using apex personally, as it gets to be way to much of a hassle trying to do it with formulas and workflows, unless it is a single time you need.

 

--KC

All Answers

kcpluspluskcplusplus

You can, it really depends on what you are trying to do though. If you are simply trying to enter a static time with a date, it is fairly simple using the DATETIMEVALUE, the TEXT function and concatenating the static date on the end of a date. If you are trying to use dynamic times it can be a little more difficult, as converting data types and time zones then become a factor. I find it much easier to do something like this using apex personally, as it gets to be way to much of a hassle trying to do it with formulas and workflows, unless it is a single time you need.

 

--KC

This was selected as the best answer
sdbsdb

Thanks, I found the DATETIMEVALUE function in the SF doc. Wonder why it does not display (the way that DATETIME does) in the list of available functions in the Advanced Function editor? Anyway, thanks again for your help.