Function to update a date field copying another date field

Function to update a date field copying another date field

Hello,

I need to create a workflow that updates a date field. To this update, I can get the date in a two different ways:

1. copying the same date calculated in another custom formula field. 
2. adding the number of days from one number field to a date field.

Could anyone help me with this custom function?

Thank you