Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

getting 1970 as the year when check sys_created_on

Alon Grod
Tera Expert

Hi,

I have the field sys_created_on on the incident table.
When I do:
var a = g_form.getValue('sys_created_on');

alert(a)

 

Im getting the date:
1970-01-03

Why Im not getting the actual date which is two days ago

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Alon Grod 

 

https://www.servicenow.com/community/developer-forum/getting-1970-01-03-12-13-00-as-a-output-when-ac...

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

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

Sohail Khilji
Kilo Patron

Hi @Alon Grod ,

 

 

Did you try : 

 

var a = g_form.getDisplayValue('sys_created_on');

alert(a);

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

James Chun
Kilo Patron

Hey @Alon Grod,

 

That's odd, it works fine.

JamesChun_0-1709496574956.png

 

What does the XML say?

JamesChun_1-1709496629742.png

 

Cheers

 

 

Maddysunil
Kilo Sage

@Alon Grod 

Please bring the created field on the form and validate once, also please share the screenshot of that, I am getting the exact value (screenshot attached).

Screenshot 2024-03-04 at 9.33.30 AM.png

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks