Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to get current date and time of our instance(which was mentioned instance)

Sathwik1
Tera Expert

We are using Europe/Oslo Timezone in our instance....

so when I am using "new GlideDateTime" is it possible to get "CET Time zone"

because as per the servicenow  we will get "GMT" right?

@Ankur Bawiskar 

1 ACCEPTED SOLUTION

Simon Christens
Kilo Sage

Hi

There are different methods in GlideDateTime to get various formats and date / time

Remember that europe are in CEST at the moment (summer time which adds 1 extra hour to UTC +1)

var gdt = new GlideDateTime(); //Always UTC +0
gs.print(gdt.getValue()); //Always UTC +0
gs.print(gdt.getTZOffset()); //amount of time in ms added to UTC +0 duo to local timezone and summer time
gs.print(gdt.getDisplayValueInternal()); //Local time in server format yyyy-MM-dd HH:mm:ss
gs.print(gdt.getDisplayValue()); //Local formatted local time

Hope it helps you out

View solution in original post

2 REPLIES 2

Simon Christens
Kilo Sage

Hi

There are different methods in GlideDateTime to get various formats and date / time

Remember that europe are in CEST at the moment (summer time which adds 1 extra hour to UTC +1)

var gdt = new GlideDateTime(); //Always UTC +0
gs.print(gdt.getValue()); //Always UTC +0
gs.print(gdt.getTZOffset()); //amount of time in ms added to UTC +0 duo to local timezone and summer time
gs.print(gdt.getDisplayValueInternal()); //Local time in server format yyyy-MM-dd HH:mm:ss
gs.print(gdt.getDisplayValue()); //Local formatted local time

Hope it helps you out