javascript Date() options
I am trying to pull out something similar to an HL7 date/time stamp in a custom zen page , in a javascript code section.
var d = new Date();
(Fri Jan 12 2024 16:58:30 GMT-0500 (Eastern Standard Time)
but,
var year = d.getFullYear();
<Error>
d.<formatcmd> doesn't seem to work. (d.getmonth, etc.)
Is there and date formatting I can use inside a javascript routine?
Comments
check if the date object var d=new Date();
is inside your routine or at least globally defined
Hello, it's not so clear, but if you try to convert date to HL7 you can use this:
d.toISOString().replace(/[-:]/g, '').split('.')[0]This should generate a string with d in HL7 format.
Thanks all. I ended up creating an ObjectScript Method that used $ZDATETIME and then called that method from within my Javascript routine.. (Which I should have thought of before I posted in the first place :) )