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

Time Format reads 0:00am for midnight

sjsmith
Registered: Sep 2 2008
Posts: 28

Is there a way to have midnight (0:00am) appear as 12:00am while still using the Time Format feature?

I have a time entry form that calculates hours from entered times, but the users are all confused by the "0:00am" entry.

My Product Information:
Acrobat Pro 7.0.7, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yeah, this is an irritation feature of util.printd(). Scanning times is just as problematic. I write some special code to detect this one situation and overide the format operation.
 // Do regular formattingcFmtData = util.printd("....",myTime);if(myTime.getHours() == 0){// 12 midnight, replace "00" with 12cFmtDate =  cFmtDate.replace(/00\:/,"12:");}

or something like this

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]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

sjsmith
Registered: Sep 2 2008
Posts: 28
Where does this go? As a document javascript or as a text field custom calculation script?

I've tried playing around with both and it's not working for me.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The code is part of a custom formatting script. Where the field value is converted into Date object and then it is reformated using the "util.printd()" function. But, how it's actually done depends on your particular setup. This is perfect for a calculated field because you don't need to worry about handling user input?

How exactly does your calculation work? What is the format of the data used in the calculation? Is the calculated value used in further calculations? Or is this field the end of the line?

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]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

sjsmith
Registered: Sep 2 2008
Posts: 28
(Sorry I didn't respond sooner, but I got sidetracked by another project.)

Users enter the Date and their Time In/Time Out for each day worked with a total number of hours worked for each day. Then I have a document Javascript that converts their time entries to decimal hours (i.e. 1 hour 30 minutes to 1.50 hours). When I use the Format feature on the "TimeIn" and "TimeOut" fields, I get the 00:00 am problem.
djjones
Registered: Jul 24 2007
Posts: 14
I'm working with a fill in pdf form that simply changes the boarder color to transparent for every text field that has a value in it. I need to do the same thing for the checkboxes but it's not working. Can someone please help.


for ( var i = 0; i < this.numFields; i++)
{
var fname = this.getNthFieldName(i);

var f = this.getField(fname);
if (!(f.valueAsString == ''))
{
color.transparent = new Array("T")
f.strokeColor = color.transparent
};
};
djjones
Registered: Jul 24 2007
Posts: 14
Sorry, the script in the previous post is only for the text fields, which does work. the following is what I have for the checkboxes but instead of only changing the checkboxes with a value in it (which the forms designer decided to use a cross instead of a check - should it matter?) it changing all boxes whether there is a value or not.
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
You are hijacking this post or your problem is not related to the original issue of the time format and the display for midnight.

You really need to start a new post.

George Kaiser

djjones
Registered: Jul 24 2007
Posts: 14
Ooops! Please excuse me
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
djjones,
Your post has nothing to do with the topic on this thread. Please creat a new thread.

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

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
sjsmith,
The Time format option on a text field uses the "util.printd()" function I mentioned in the first post. Which unfortunately turns 12:00 am into 00:00 am. To get around this issue you have to write your own time format script, as I've shown in the first post.

To get more information see this series of articles:
http://www.acrobatusers.com/tutorials/2006/date_time_part1

I've also written extensively on this topic at www.pdfscripting.com

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]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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