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

How do I convert data into a Date- or Calendar object

zmicdog
Registered: Jan 17 2010
Posts: 6
Answered

Hi!

I am beginner in java script and I hope someone can help me. I am creating a "time sheet". I have a table with five columns.

The names of the columns in the first row in the table are:

feeRow.0.date | feeRow.0.time | feeRow.0.typeOfFee | feeRow.0.premises | feeRow.0.premisesAddition

The format of field "feeRow.0.date" is yyyy-mm-dd
The format of field "feeRow.0.time" is hh:mm

1. Shall I use a Date object or a Calender object?
2. How do I do the conversion?

I am working with AcroForm. I have searched the Internet but not found what I am looking for. Hope you can help me!

My Product Information:
Acrobat Pro 9.2, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2399
There's no such thing as a Calender object in JavaScript, only a Date object.
You can use util.printd() to print a date object in a specific format.
Look in the reference file for more information.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
You can use the 'util.scand(dFormat, cDateTimeString)' method to obtain the date object from you date and time fields. But it looks like you are entering the value of elapsed time and not the start and end times.

For using the elapsed time value, you will have to write some JavaScript to split the hours and minutes and then convert the values to a common time unit, like minutes, which can then be used for your time computations. After you have your total you will need to convert the common time, minutes for example, back to hours and minutes.

George Kaiser