Java help

knownheroknownhero Member Posts: 450
Hi Guys,

Was wondering if anyone could help me. Im very new to java and was wondering if you can write a script for it to calculate the differents in days two date filed boxes has entered in them. So say the start date was 01/12/2011 and finish was 12/12/2011 I want to have a box (which is numeric) show the amount of days there are the person wants to take off.

Im creating a LiveCycle form for holiday requests and this would be a pretty nice feature to have.

Any help in this matter would be great.

Kind Regards
70-410 [x] 70-411 [x] 70-462[x] 70-331[x] 70-332[x]
MCSE - SharePoint 2013 :thumbup:

Road map 2017: JavaScript and modern web development

Comments

  • the_Grinchthe_Grinch Member Posts: 4,165 ■■■■■■■■■■
    Shouldn't be a problem, but you have to factor in weekends as well. Don't know Java very well, so hopefully someone who does can chime in.
    WIP:
    PHP
    Kotlin
    Intro to Discrete Math
    Programming Languages
    Work stuff
  • knownheroknownhero Member Posts: 450
    Touche on the weekend thing. Forgot about them :D
    70-410 [x] 70-411 [x] 70-462[x] 70-331[x] 70-332[x]
    MCSE - SharePoint 2013 :thumbup:

    Road map 2017: JavaScript and modern web development

  • RobertKaucherRobertKaucher Member Posts: 4,299 ■■■■■■■■■■
    You mean JavaScript, I assume?
  • RobertKaucherRobertKaucher Member Posts: 4,299 ■■■■■■■■■■
    I just wanted to mention that this is actually a non-trivial task as it goes to the nature of what a work day is. For example, my work considers the 26th, 27th and 30th of Dec to be paid holidays this year. So What if my request was for the 23rd-the 2nd? Would I be required to split my request into multiple requests? How does the Java or JavaScript know about your company's calendar for the current and next year? What is the definition of a workday? Does it include Saturdays for some workers? Do you have shifts?
  • knownheroknownhero Member Posts: 450
    We work Mon-Fri 9 -5. I only really need it to exclude weekends as we get paid no matter when we go off sort of thing. On Bank Holidays dont work also but get paid. So weekends are the only thing to take out. I only ask this as I need to learn LiveCycle as Im taking over the work we do on it very soon.
    70-410 [x] 70-411 [x] 70-462[x] 70-331[x] 70-332[x]
    MCSE - SharePoint 2013 :thumbup:

    Road map 2017: JavaScript and modern web development

  • RobertKaucherRobertKaucher Member Posts: 4,299 ■■■■■■■■■■
    So, are we actually talking JavaScript, then?
  • Daniel333Daniel333 Member Posts: 2,077 ■■■■■■□□□□
    Java and JavaScript are really not really related.I'll assume you know how to pull data from a textfield and cast it. In which case you want these..

    Java you want java.time.*
    http://exampledepot.com/egs/java.lang/ElapsedTime.html

    Javascript
    Calculating the difference between two dates in JavaScript
    -Daniel
Sign In or Register to comment.