These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Date/Time Problem in Javascript.

deepusrp
Registered: Jan 12 2009
Posts: 51
Answered

Hello All,

I need to maintain some history on my pdf form, so i need to get date and time when user submits the form. Right now i'm able to do this in FormCalc.

var todayDate = Date()
var todayTime = Time()
var today = concat(Num2Date(todayDate, "MMMM DD, YYYY"), " ", Num2Time(todayTime, "h:MM A"));

today will contain: April 28, 2009 2:23 PM

I want exact functionality in javascript. I'm not able to get the same result.

Please give me some code snippet for the same in javascript

Deepak.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
var today = util.printd("mmmm dd, yyyy h:MM a", new Date());

Take a look at this series of articles:
http://www.acrobatusers.com/tutorials/2006/date_time_part1

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

deepusrp
Registered: Jan 12 2009
Posts: 51
Hi thomp,

Thank a lot...

Thats a good function...

There is a slight correction: instead of 'a' in the format string it should be tt thats it.

var today = util.printd("mmmm dd, yyyy h:MM tt", new Date());

I got this form the links that u provided.

Thanks once again.

Deepak