# Run formula only once on Salesforce custom Date/time field

I was facing some time-zone related issue with custom date/time object on salesforce basically I am creating/updating that value via force.com api's from different application. And salesforce convert the date/time value on default TimeZone witch is GMT.

On Salesforce user/organisation setting I have different timezone (not in GMT it's GMT+5:30 IST) So every time when record is created its show the value in GMT not in GMT+5:30.

What I did to convert the custom date/time filed timezone into local/setting timezone I used a formula custom date/time field in Salesforce and use DATETIMEVALUE( Date_Time__c ) formula which gives me the local/setting timezone.

But the problem is it's keep updating the value and I want this only that time of creation of object. After doing some re-search on salesforce found some formula where they are using AND and OR to achieve this but for me all of them not working because I want date/time object in return not boolean.

If you have any idea please let me know ...

I think you want something like the below,

You have mentioned the value should be updated only on creation then just create a date time field instead of formula field.

Create a workflow rule with criteria Isnew() then create a field update on the newly created date time field based on the formula DATETIMEVALUE( Date_Time__c ).

Hope this will be useful for you.

If you want to capture the date only is new criteria, i think you can use DATETIMEVALUE( createddate )

• This will keep updating the date but I don't want to update the captured/created date/time – Anil Yadav Nov 20 '17 at 16:26