What script would I use for a timesheet using 12:00 am?

I have been able to add a document level script using Acrobat Pro to show midnight as 12:00 am. But my calculations still don't work. As I have it scripted right now a start time of 12:00 am and an end time of 1:00 am equals -11.00 hours not 1.00 hour. What script would I have to add so the calculation is correct?
Here is the script I have right now:
// start time
// Start time field name
var cStartName = "start1mon1";
// Start time format:
var cStartFormat = "HH:MM";
// end time
// end time field name
var cEndName = "end1mon1";
// End time format:
var cEndFormat = "HH:MM";
// some conversion functions
// function to convert time string to minutes
function Time2Num(cTime, cFormat) {
// convert time string to minutes
// convert time string to date object
var oDate = util.scand("mm/dd/yyyy " + cFormat, "01/01/1970 " + cTime);
// convert date object to number of milliseconds
var nTime = oDate.getTime();
// convert milliseconds to minutes and return value
return Math.round(nTime / (1000 * 60));
} // end Time2Num function
function Num2Time(nMinutes) {
// convert time string to Hours and Minute
// hours in nMinues
var nHrs = Math.floor(nMinutes / 60);
// remainder minutes from hours in nMinutes
var nMins = nMinutes / 60;
// return formatted time string
return nHrs, nMins;
} // end Num2Time
// end conversion functions
// perform the calculation using the fields:
// get the values of the fields
var cStartTime = this.getField(cStartName).value;
var cEndTime = this.getField(cEndName).value;
// clear the value
event.value = "";
// test for not null time strings
if(cStartTime != "" && cEndTime != "") {
// compute the time difference in minutes
nDiff = Time2Num(cEndTime, cEndFormat) - Time2Num(cStartTime, cStartFormat);
event.value = Num2Time(nDiff);
} //end not null values
I have no prior knowledge of JavaScript, only what I have found here on the forums and a lot of luck. I would appreciate help on this problem. Thanks!

Thank you Gilad D, that worked making a hidden field and just creating the subtraction for the break with that field!   But for future reference if anyone else comes across this question, this is what I used for the time without subtracting the break.
// Get first field value
var v1 = getField("Finish Time 1").value;
//Split field value
var time1 = v1.split(":");
// Get second field value
var v2 = getField("Start Time 1").value;
//Split field value
var time2 = v2.split(":");
var min1 = time1[0]*60 + time1[1]*1 //
var min2 = time2[0]*60 + time2[1]*1 ;
event.value = ((min1 - min2) / 60) ;
If anyone know how to add a break into this script, have at it! But creating a hidden field with the answer of the above script and then creating another box that takes that number minus a break worked good.

Similar Messages

  • What command would you use to check for allocation, structural, or logical integrity problems?

    What command would you use to check for allocation, structural, or logical integrity problems?

    Wondering if you are looking for DBCC CHECKDB command? For more information, on that command, try to look at this:
    http://technet.microsoft.com/en-us/library/ms176064.aspx

  • What program would I use in creative cloud to search a large audio file for sounds.

    I have sleep apnea and want to search large audio files for my snoring.   what program would I use and any other tips would be great.
    thank you

    Moving this discussion to the Audition forum. 
    VTX1300C Audition is the sound editing program included with your Creative Cloud Membership.  The users in this forum may have some additional Audition specific tips or an alternate workflow which you can utilize.

  • Hey what program would you use to make Kinetic Typography

    What program would i use and if there is one please post the link for it thanks

    I found this thread, you may find it helpful:
    https://discussions.apple.com/thread/2302254?start=0&tstart=0

  • What behavior would I use to make a bitmap image shake? Thanks.

    What behavior would I use to make a bitmap image shake? Thanks.

    There are several options for making images (or any object) shake:
    -Earthquake Filter
    -Randomize Behavior (Parameter Behaviors)
    -Wriggle Behavior (Parameter Behaviors)
    You can apply these to the X&Y together, or 1 instance to each channel.

  • A simple percentage? How does one add a percentage to a number? If I have 100 and I want to add 15% and get a total, what formula would I use?

    How does one add a percentage to a number? If I have 100 and I want to add 15% and get a total, what formula would I use?

    You can do something like this:
    D2=B2*(1+C2/100)
    this means in the cell D2 type the following "=B2*(1+C2/100)"... leave out the double quotes

  • What api would I use to get the number of chars in string?

    What api would I use to get the number of chars in string?

    Assuming that you really mean that you want the number of charaters in a String (not string), that would be documented in java.lang.String
    The method is length()

  • What function would you use instead of "IF" when referencing durations from a pop-up menu. Ie; if c4 equals 1h enter 280, if c4 equals 30m enter 160, etc. IF works fine if c4 is formatted as text but returns 0 when formatted as pop-up.

    What function similar to IF would one use when the reference cell is a pop-up menu of items in duration format?
    Example: if C4 equals 1h enter 280, if C4 equals 30m enter 160, etc
    i can get it to work fine if I format the cell to text but I not only need it pop-up, I also need it to be written in duration format because it's used as duration in other functions.
    thank you for your help in advance
    Christina

    Hi Christina,
    A screenshot is always helpful.
    C4 is your popup? You want to chose a duration there and have 280 or 160 show up somewhere else? Are they the results of a mathmatical formula or do you want a lookup table to show them?
    I suspect something else is going on in your table. I have no trouble having a popup recognized as a duration:
    The formula in C2  =DUR2MINUTES(B2) displaying "60" as expected. Note that "60" is not a duration. If I want C2 to be a duration I need the formula to read:
    =DUR2MINUTES(B2)&"m".
    I hope this helps, if not, post a screenshot including relevant formulas.
    quinn

  • What equation would I use...

    I appreciate the help on this question.  I am an attorney I would like to develop a spreadsheap in Numbers (and Pages) that does the following simple thing:
    Column B would have a retainer figure.  Say $1000 for the first entry.
    Column C would have my total running for the month.  At the first entry that would be $1000.
    Column B, row 2, would have 1500 for my next retainer.  Column C, row 2, using an equation would have the new figure of $2500.  Also, Column C row 1 would retain the previous total of 1000.
    Column B, row 3, would have 500 for my next potential retainer.  Column C row 3 would automatically, using an equation, would have the figure of $3000.  The previous rows in column C would retain the previous totals.
    What equation or formula would I use to populate column C with a running total?

    =SUM($B$1:$B1)
    Put that in C1 and then copy it down the column.  C2 should have the exact same formula except the last B1 is now B2, and likewise down the table.  You're telling it to start at B1 for each entry, but to stop at the row in B that is identical to that row in C.
    Vince

  • What app would I use to create an online report like this?

    What Adobe CC app would I use to create a web based report like this?
    http://sowc2015.unicef.org
    Could it be done with Muse or does it need something like Dreamweaver and bespoke coding?

    HI,
    Yes, you can create such site using Adobe Muse. You will need anchors points to scroll down. You can take a look this article
    http://www.lynda.com/Muse-tutorials/Understanding-anchor-links/161871/179008-4.html
    Do let me know if you have any question.

  • [Solved]What WM would be best for a dedicated console emulator box?

    Hey all
    So, using a recycled, slightly old small-form-factor computer, I am making a dedicated emulation box. It will run game console emulators for every game system I can think of. But anyways, that is what I intend to use this box for, and only that. I have been setting it up from an Arch Linux base install, aiming to consume the least resources I can (because it is an older box, and I want the best performance with my emulators). I need a recommendation on a Window manager that therefore:
    -Does not have ANY sort of taskbars/titlebars/other stuff in the way.
    -Consumes the least resources possible
    Now, the current winner is just a default X11 shell that is seen when xinit is run. However, the shell does not cover the whole screen. I want the screen to be all one colour. Because I want the look of using this box with my friends to make it look put together.
    Any recommendations?
    Scott
    Last edited by Scotty (2010-12-23 19:02:17)

    Meyithi wrote:
    I dunno about dwm, it has some bugs with fullscreen apps - funnily enough emulators seem to give it trouble, ScummVM will not run fullscreen on my install for instance.
    I'd vote for Openbox, it has no taskbar or anything by default, windows will be initially themed but you can disable window borders and even the right click menu if you wish.
    I was thinking openbox at first, because I use it on my main computer and know it pretty well. Thanks.
    I was considering dwm, but thanks for the advisory about the fullscreen bugs.
    I'll give evilwm a shot too. And give making the x11 shell bigger a shot too.
    Thanks for the recommendations, but I have another quick question:
    Is there any way to automatically login to the root account on the TTY without the use of X? This machine, once setup, will be only in my house and not connected to the internet, so the dangers of running as root are virtually 0. I want this because, on boot, I will just have to press power, and then without doing anything (aided by a bit of bash) I will be taken to a menu of sorts to select what console and game I want to play.
    Scott

  • What software would I use to make an ios app?

    What software could I use to make an IOS app?

    Apple's IDE, Xcode.
    See Xcode Versions ~ iOS - As of 9.19.12

  • What is this and what updates would I use?

    Hi all,
    Just bought a Gateway system based on the Intel i7 - 920 chipset, ATI HD49850 video and many other things...
    The audio that comes with it is very confusing.
    In the systray there are TWO audio panels. The first is for the Realtek HD audio. The second is for something called the Creative X-Fi MD audio.
    In the system manager it shows two audio hardware entries, Realtek and ATI (from the video card).
    It does not show anything for Creative. Yet, the creative control panel handles all the excellent audio controls and effects for the machine and without it, I do not get access to any of the high end sound.
    So what is this? Is the hardware Realtek or Creative and why or what is the difference here between the two? Based on the ports on the back, this appears to be built into the mainboard and since I have not opened the machine yet I cannot tell much about the hardware layout.
    The questions come about because this machine has built in hot swappable hard dri've bays for E-SATA and SATA. Awesome feature!
    And while working on making sure all drivers were current, I wanted to update all audio as well but I have no idea what I should be looking for now in terms of drivers. Checking the Creative drivers area shows no entries for the X-Fi MD whatever that is. Thus the only drivers I currenly have are the ones that came with the machine, which when installed again do so via the full Creative installer. It fully supports and installs Alchemy and all other tools.
    So if you are confused by all this, join the club... Anyone know anything about this?
    BTW, this machine is fast and loaded with features.. I recommend it big time.

    stretchtee wrote:
    I cannot figure out how to delete it the normal ways.
    As in holding the app untill they wiggle?

  • What SONG would you use for this slideshow?

    I'm working on a slideshow that basically chronicles the first year of my son's life for his 1st birthday. I've hit a creative road block and was wondering if anyone had any good ideas for a song that would fit perfectly to go along with this occassion.
    Thanks for your help = )

    John Lennon's "Beautiful Boy"

  • What Macbook would be perfect for me? What would best suit my activity/needs?

    I currently have a Toshiba L650 Satellite.
    I'm an 18 year old female, and I want to buy my very first macbook.
    As Macbooks are expensive, I want to get the perfect one for me.
    I use my laptop for:
    -Photoshop (I edit a lot of pictures/gifs/etc)
    -Photo's (lots of photos I take on my camera I store on my computer, this also means I want an SD card slot)
    -USB plug ins.
    -Music (So I want to be able to put discs in my computer)
    -Storing videos. (Average amount, not lots, just average amount of videos)
    -Word documents I use often.
    -Internet (I spend A LOT of time on the internet - facebook, youtube, social networking, browsing, etc. My laptops main use is the internet and photos)
    -I watch some TV shows on it, like Vampire Diaries, etc sometimes.
    -I'm not really a gamer. I do, however, play the sims 3 ocassionally and I'm thinking about buying Skyrim, but don't know about this one, maybe not.
    -I webcam a lot too. Via Facebook generally. But sometimes Skype too.
    & I think that's about it.
    What would be the better Macbook for me?
    I was looking at either the Macbook pro 13" or the Macbook air 13" - but don't know which one or if neither of these would suit me.
    I like my computers to run fast and I like as much memory as possible. However, on my current laptop I've only used 83gb I think. It says total space is 583gb and there's 500gb remaining so I think that means I used 83gb?
    On my new laptop, I want to store a bit more stuff than that though. So what is best for me?? What MAC is best for me??
    I don't know a lot about computers so you may need to explain thoroughly for me to understand better.

    Most of your list could be supported by either MacBook you listed. I think if you are a heavy user of Photoshop that you will find the MacBook Pro to be the better solution.
    You version of Photoshop that you have on your Toshiba will not run  on the Mac and will have to be replaced with the Mac version. Adobe may make you a deal on the Mac version. Call an ask their sales staff what they can do for you if you want to stay with PS.
    Seeing as how you are planning on switching platform, you may want to check out two applications from Apple before you switch which are iPhoto and Aperture.
    The first iPhoto will come with you Mac and is a way of storing photos and doing simple editing on them. It is very well integrated with the rest of the software on the Mac.
    The other is Aperture. This is an extra cost item that is for the more serious user. It is capable of much more powerful edits on your photos.
    Allan

Maybe you are looking for

  • No standard agreement found Error.

    Hi i am working on File to IDOC scenario and i am getting the below error. "No standard agreement found for , D_XXX_YY, B_XXX, ECC1800". I deleted all my Config objects and recreated and reactivated.cache is up to date but still no use. When i test t

  • After upgrading to 8.1 in windows, my ipod is not recognized in computer or itunes

    I upgraded to Windows 8.1 a while back, and just tried to synch my ipod with itunes and now my ipod is not being recognized in my comuper or itunes. Does anyone know why this is and/or how to fix it? Thanks!! Amber

  • Factory unlocked?

    How is it possible to tell if an iphone is *factory unlocked* by Apple. I'm not talking about 'unlocked' jailbreaking illegal stuff..I'm talking about a legitimate unlocked phone by Apple. I want to make sure it's a legally (and therefore factory unl

  • Submit pdf to web service as xml

    I want to do the following: a) Create a pdf form that the user can fill out and save using their laptop. b) The user goes back to the office, opens the pdf, and clicks a submit button. c) The submit button contacts a web service (that I will write) a

  • External Charger for iPod touch?

    Hi. I got a doubt. Did my old external charger (it works perfectly with my old iPod Photo) works with the new iPod Touch? I'll apreciate any answer. I didn't know if plug it or not. The charger has the same voltage (5V), so I suppose that it gona wor