Saturday, March 9, 2019

Converting a DateTime field into a Unix Timestamp with formula field

In this episode, we will show you have you can easily convert a date time field value to an Epoch/Unix Timestamp using Salesforce formula field.

First, you need a field of type DateTime such as CreatedDate, LastModifiedDate or any Custom Field.

In our example, we will use the CreatedDate Field. The formula is as below.

(CreatedDate - DATETIMEVALUE( "1970-01-01 00:00:00" )) * 86400

This can be used to append to a image url to prevent image cache from browser.