[SalesForce] How to update a date field with data from another date field in workflow rules

I have a workflow rule in place that needs to update a date field when another date field is is filled.

IF Date1 is filled, assign Date1 value to Date2.

What's the best formula to use in my Workflow action?

ETA: My 2 date fields have different data types. Date1 is Date and Date2 is Date/Time. I want to keep both data types as they are. Is there an enhanced formula that can convert 1 field to be compatible to the other and allow the update?

Best Answer

From the help docs:

Converting Between Date/Time and Date
Date and Date/Time aren’t interchangeable data types, so when you want to perform operations between Date and Date/Time values, you need to convert the values so they are both the same type. Some functions (such as YEAR(), MONTH(), and DAY()) also only work on Date values, so Date/Time values must be converted first.
Use the DATEVALUE( date/time ) function to return the Date value of a Date/Time. For example, to get the year from a Date/Time, use YEAR( DATEVALUE( date/time ) ) ).
You can convert a Date value to a Date/Time using the DATETIMEVALUE( date ) function. The time will be set to 12:00 a.m. in Greenwich Mean Time (GMT), and then converted to the time zone of the user viewing the record when it’s displayed. For a user located in San Francisco, DATETIMEVALUE( TODAY() ) returns 5:00 p.m. on the previous day (during Daylight Saving Time) rather than 12:00 a.m. of the current day. See A Note About Date/Time and Time Zones for more information.

I bolded the 2 you would need to use.

Related Topic