convert date time into local timezone

Malaya
Giga Expert

I am pulling date from a change request table in notification script. the date time is converting into GMT which is throwing off my date/time for the change request.. how to convert the date time into local time zone to get the correct value .

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

Use getDisplayValue();



current.<date field_name>.getDisplayValue();


View solution in original post

10 REPLIES 10

Abhinay Erra
Giga Sage

Use getDisplayValue();



current.<date field_name>.getDisplayValue();


Chuck Tomasi
Tera Patron

Hi Malaya,



IF you are getting the date and time form a script, use the getDisplayValue() method on the variable.



e.g. current.start_time.getDisplayValue()



If you can, include some details (code, script, notification message content) of what you are doing. Thanks.


Thanks @chuck and @Abhinay... i was pulling system value rather than display value... got it working now...


Hello CHuck,

 

 

I hope you can help me, please:

 

 

I have this  topic:

 

In the record:

 

There is a field that store date time 

 

 

 

and I need to bring that value in a serivice and I am using the Ajax function

 

Here the code

 

***********************************************************************************************

 

var ga = new GlideAjax("AutoFrameAjax");
ga.addParam("sysparm_name", "records_get_list");
ga.addParam("sysparm_table", "sc_req_item");
ga.addParam("sysparm_query","number="+newValue);
ga.addParam("sysparm_fields", "cat_item,short_description,opened_at");
ga.getXML(function(response) {
var result = JSON.parse(response.responseXML.documentElement.getAttribute("answer"));

var item = result[0]['cat_item'].toString();
console.log("item 2" + item);
var shortdes = result[0]['short_description'].toString();
console.log("short 2" + shortdes);

// var installDate = new GlideDateTime();
//installDate.setDisplayValue(result[0]['opened_at'].getDisplayValue());
var opened = result[0]['opened_at'];
// alert (opened);
console.log("opened 2" + opened);


g_form.setValue('u_request_name', item);
g_form.setValue('u_request_short_description', shortdes);
g_form.setValue('u_request_start_date', opened);

 

opened is the value that I require...

***********************************************************************************

 

the stystem brings this:

 

 

 

 

The value has 6 hours more.....

 

How can I obtain Local Zone time in the field...

 

 

 

Note: I can't create new catalog client script include

 

 

Please  HELP!