Hi , I want convert on timezone to another timezone .

p_jaya
Kilo Contributor

Here i am using moment Js for   conversion.   First i have copied the code from http://momentjs.com/timezone/   and paste in ui scripts. Then i have used ui page client script to call the moment function.   here is my code  

var now=moment().tz();

  alert('current time:'+now);

      var d=moment.tz(now,"Chile/EasterIsland").format('YYYY-MM-DD HH:mm:00');

  alert('converted time : '+d);

But it is not working.

My requirement is user will give time and zone . According to that   i want to convert that time into IST.

8 REPLIES 8

I have a table with countries column and time column it contains random time in respective local time zones.


example


London 7am GMT


Europe 12pm EST



Now I want to convert all the time zones into IST and store it in another column.


the functions like convert to IST and convert to UTC are considering the time column in my table in the local time zone of system irrespective of country.


example :
while converting it assumes 7am as IST instead of GMT as my system time zone is IST.


I can write manual function to achive what is required but it will be not automated if new country is added and is not practical.



Can you help me ?


Hi Jayanthi,


Just to make one thing clear, if you got a table having a date column and dates are dynamic from different time zones.


I think you will be able to see those time as per your time zone (system timezone if you have not set your time zone) so, all dates are already converted into system timezone. You just need to use above code to convert it IST


did you find any solution for your situation?

 

zica
Giga Guru

HI There,



I have been tasked to do the same thing when the state of the incident changes to awaiting user. In this case, when the state is awaiting user, a new field 'date' displays and the user has to put a date.



I saw that depending on the location of the user, the date is changed automatically. In other words, if the user from London put 10.15AM as a date, the user from New York will read 5.15 and Honk Kong 18.15


Service now manages perfectly the timezone of the user. it is accessible on the user table. For me I didn't need to script.


I thought this little tip will help more than one.



Kind Regards,


ZA



Don't feel shy to mark correct or helpful answer if it helps or is correct