Setting a Date-Time field with a GMT value

Jamsta1912
Tera Guru

Hello all,

I'm trying to write a business rule that manipulates a date/time string always provided to us in GMT, to then populate a date-time field on a record.

I'm struggling to populate the field with the GMT time, ie it's always interpreted as the display time (local time).

Is there a function that directly sets a datetime field with the GMT time, so that the display time is then in the correct time zone?

I've tried using setValueUTC:

var dtNew = new GlideDateTime();

dtNew.setValueUTC("15-02-2011 08:00:00", "dd-MM-yyyy HH:mm:ss");

my_record.my_date_time = dtNew;

but in this case it's the display time of 'my_date_time' that ends up set to 15-02-2011 08:00:00.

5 REPLIES 5

Hi Jamie,

 

How did you use setValue(); Could you please update it here?

 

Regards,

Dipam kalita