Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to Get the current date time using a client script.

Shraddha desai
Tera Contributor

Hello

How to Get the current date time using a client script.

17 REPLIES 17

AnirudhKumar
Mega Sage

The most direct way is to use glideajax and in the script include return gs.nowDateTime()

@AnirudhKumar 

Thanks for help.

Can you show the demo what have to do exactly?

 

Ankur Bawiskar
Tera Patron

Hi,

you can get it in client script like this

var today_date = new Date();

var today_date_time_str = formatDate(today_date, g_user_date_time_format);

alert(today_date_time_str);

Output: my local time i.e. IST

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Shraddha desai 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader