Unexpected adjustments from Formula Field Date/Time (Adjust

Posted by Charles Ford on 25-May-2017 06:09

Hi,

I've have two objects with relationship: Many Opportunities to Many Events. When I try to find the earliest Event for an Opportunity using a Formula Field I'm seeing the wrong local time adjustment being applied and this leads to an incorrect date difference for me.

var date = rbv_api.selectValue("SELECT min(startDate) FROM obj_event WHERE eventOpportunity = ?", {!id});
rbv_api.println(date);
return date;

My earliest Event is Thu May 18 2017 00:30 as entered client side UI.

With Formula Field: Date/Time (Do not adjust):
Debug: 2017-05-17 23:30:00.0 - as expected
Return: Wed May 17 2017 22:30:00 (IST) - this seems 1 hour too early I'm expecting Wed May 17 2017 23:30:00 (UTC)

With Formula Field: Date/Time (Adjust to user time zone)
Debug: 2017-05-17 23:30:00.0 - as expected
Return: Wed May 17 2017 23:30:00 (IST) - this seems 1 hour too early I'm expect local time of Thu May 18 2017 00:30

Time Zone: (GMT) Greenwich Mean Time (IST) Europe/Dublin, ZoneInfo[id="Europe/Dublin",offset=0,dstSavings=3600000,useDaylight=true,...]
Release 4.5.2.0

Cheers
--
Charles

All Replies

Posted by Shiva Duriseati on 05-Jun-2017 05:29

Hi Charles,

Please use following code with Formula Field:Date/Time (Do not adjust):

Example:

var a=rbv_api.selectQuery("SELECT startDate FROM EventObject WHERE eventOpportunity = {!id} ORDER By startDate ASC",1);

rbv_api.println(a[0][0]);
return a[0][0];

Please let me know if this works for you. Meanwhile I will look into other date adjustments and get back to you shortly.

 

Regards,

Shiva

Posted by Charles Ford on 06-Jun-2017 03:52

Hi Shiva,

Mine first line, yours second line:

2017-05-17 23:30:00.0

Thu May 18 00:30:00 UTC 2017

So the selectQuery does return the result I expect, thank you. I was using selectValue for brevity (the case when no data is returned).

Thanks

--

Charles

This thread is closed