+ Start a Discussion
Kushal MishraKushal Mishra 

Formula field giving wrong TIME ZONE value

Hello All,

I have created following Two formula fields.

1:-  CreateDateTImeBeforeOneHr1__c:- 
    TEXT((YEAR( DATEVALUE(CreatedDate))))+'-'+TEXT((MONTH( DATEVALUE(CreatedDate))))+'-'+TEXT((DAY( DATEVALUE(CreatedDate))))+'       12:00:00 AM'

OUTPUT1 :- 2015-11-7 12:00:00 AM

2:- CreateDateTImeBeforeOneHr__c:- 

  DATETIMEVALUE(CreateDateTImeBeforeOneHr1__c)

  OUTPUT2 :- 11/7/2015 4:00 AM

i am getting wrong time zone .  
Please can you please tell me How can we get 2015-11-7 12:00:00 AM in OUTPUT2.
 
pconpcon
The problem is that DATETIMEVALUE assumes that the input is in GMT and then renders it in your local time.  If you want to convert from GMT to your local time, I'd recommend looking over this knowledge article [1] however it only deals with Date not Datetime.

[1] https://help.salesforce.com/HTViewSolution?id=000181642