Hi there,
I am looking for a javascript function that someone might have already
written to calculate the paid-time-off.
Given are the start and end date and time. I need to calculate the
paid-time-off. That means the formula needs to be smart enough to figure out
the Saturdays and Sundays within the period and subtract the time from the
time period.
Has anybody some code to share with me or can you point me into the right
direction to get this functionality written?
Thanks a bunch,
Daniela 12 1988
Daniela Nii wrote: Hi there,
I am looking for a javascript function that someone might have already written to calculate the paid-time-off.
Given are the start and end date and time. I need to calculate the paid-time-off. That means the formula needs to be smart enough to figure out the Saturdays and Sundays within the period and subtract the time from the time period.
Has anybody some code to share with me or can you point me into the right direction to get this functionality written?
Start by explaining how you would manually calculate it, and post it.
Someone might be willing to write it, maybe not. But to simply say "I
want a paid time off" calculator is stretching it a bit.
The first year, I get 5 days paid vacation (1 calendar week)
The second year, I get 10 days paid vacation (2 calendar weeks)
The third year, I get 15 days paid vacation (3 calendar weeks)
I have been there since I got hired so I will get 3 calendar weeks paid
time off this calendar year. I doubt that fits your situation though.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
JRS: In article <Jg****************@newsread2.news.pas.earthlink.n et>,
seen in news:comp.lang.javascript, Daniela Nii
<da*********@earthlink.net> posted at Wed, 28 Jan 2004 23:07:21 :- I am looking for a javascript function that someone might have already written to calculate the paid-time-off.
Given are the start and end date and time. I need to calculate the paid-time-off. That means the formula needs to be smart enough to figure out the Saturdays and Sundays within the period and subtract the time from the time period.
See FAQ and sig below.
<URL:http://www.merlyn.demon.co.uk/js-date7.htm#CWD>
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Thanks, Dr. Stockton,
Those date functions are in the right direction. I will see if I can adjust
them for my purpose.
Daniela
"Dr John Stockton" <sp**@merlyn.demon.co.uk> wrote in message
news:YI**************@merlyn.demon.co.uk... JRS: In article <Jg****************@newsread2.news.pas.earthlink.n et>, seen in news:comp.lang.javascript, Daniela Nii <da*********@earthlink.net> posted at Wed, 28 Jan 2004 23:07:21 :-
I am looking for a javascript function that someone might have already written to calculate the paid-time-off.
Given are the start and end date and time. I need to calculate the paid-time-off. That means the formula needs to be smart enough to figure
outthe Saturdays and Sundays within the period and subtract the time from
thetime period. See FAQ and sig below.
<URL:http://www.merlyn.demon.co.uk/js-date7.htm#CWD>
-- © John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE
4 © <URL:http://jibbering.com/faq/> Jim Ley's FAQ for
news:comp.lang.javascript <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates,
sources. <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items,
links.
Hi Randy,
I was hoping that somebody had to do some HR (Human Resources) web
programming where an employee would go on an intranet to request paid time
off (PTO) by entering a start date/time and end date/time. It then would
calculate the actual workdays and hours for his entered period.
As an example, he enters: Tue, Jan 20, 2004, 12:00 noon - Tue, Jan 27, 2004,
8:00 am. The PTO would be 4 days, 4 hours.
Daniela
: Those date functions are in the right direction. I will see if I can
adjust
: them for my purpose.
Have also a look on www.javascriptsource.com
They have day/date calculators I think.
Wouter
"DJ WIce" <contextmenu @ djwice.com> wrote in message
news:bv**********@news.tudelft.nl... :Those date functions are in the right direction. I will :see if I can adjust them for my purpose.
Have also a look on www.javascriptsource.com They have day/date calculators I think.
javascriptsource.com may have literally thousands of scripts but when I
spent an hour looking through them I was unable to find one that was of
a suitable standard to be recommending to anyone. The bulk were
amateurish and out of date, really better avoided entirely.
Richard.
Daniela Nii wrote: Hi Randy,
I was hoping that somebody had to do some HR (Human Resources) web programming where an employee would go on an intranet to request paid time off (PTO) by entering a start date/time and end date/time. It then would calculate the actual workdays and hours for his entered period.
As an example, he enters: Tue, Jan 20, 2004, 12:00 noon - Tue, Jan 27, 2004, 8:00 am. The PTO would be 4 days, 4 hours.
Now it makes sense to me what you were trying to do. Might be something
I tinker with this weekend - no guarantees. Seems trivial at first
thought though. (Obviously is isn't)
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
: Has anybody some code to share with me or can you point me into the right
: direction to get this functionality written?
Maybe you don't mind to use Excell instead?
Field1: StartDate, format: d-mm-jj u:mm;
Field2: EndDate, format: d-mm-jj u:mm;
Field4: Field2-Field1, format: d \d\ay\s u ho\ur\s mm \mi\n\ut\e\s;
Then you have the time between.
Now you have to count the # of saterdays and sundays dan substract them.
Determine the first saterday and devide the left period of days by 7 ceil
that value.
Determine the first sunday and devide the left period of days by 7 ceil that
value.
if the first day is a saterday ..
if the first day is a sunday ..
Works pretty fast and nice in Excell :-)
The export of that to HTML has problems when you use dates where the start
time is lower than the time on the end date.
The \ are to tell Excell not to interpret that but to print it.
Wouter
JRS: In article <ck*****************@newsread1.news.pas.earthlink. net>,
seen in news:comp.lang.javascript, Daniela Nii
<da*********@earthlink.net> posted at Thu, 29 Jan 2004 19:39:52 :- Those date functions are in the right direction. I will see if I can adjust them for my purpose.
"Dr John ...
Responses should go after trimmed quotes, as per FAQ and established
usenet convention. Compliance earns consideration.
It appears that you are assuming a 5-day week of 8-hour days. On that
basis, the working-days-since-origin function can easily be adapted to
working-hours-since-origin.
Summer Time will not start/finish within working hours; nevertheless, it
could cause error. Test.
ISTM that you will need to add holiday information - see "Working Days
Ahead" on that page, and <URL:http://www.merlyn.demon.co.uk/holidays.htm>
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
JRS: In article <bv*******************@news.demon.co.uk>, seen in
news:comp.lang.javascript, Richard Cornford
<Ri*****@litotes.demon.co.uk> posted at Fri, 30 Jan 2004 00:56:06 :- "DJ WIce" <contextmenu @ djwice.com> wrote in message news:bv**********@news.tudelft.nl...:Those date functions are in the right direction. I will :see if I can adjust them for my purpose.
Have also a look on www.javascriptsource.com They have day/date calculators I think.
javascriptsource.com may have literally thousands of scripts but when I spent an hour looking through them I was unable to find one that was of a suitable standard to be recommending to anyone. The bulk were amateurish and out of date, really better avoided entirely.
I didn't take an hour; but I went straight to Calendars : Days left.
Obviously the author does not understand the uses of the Date Object; to
calculate the length of the current month, he has an array of month
lengths, correcting the second entry with a three-term leap expression.
There is little point in using anything better than Leap = Year % 4 = 0
or maybe Year & 3 = 0, for current dates.
function MonthLength(y, m) { // NS4 ?
return new Date(y, m+1, 1, -9).getDate() }
does all but the final subtraction of his code.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
"Dr John Stockton" <sp**@merlyn.demon.co.uk> wrote in message
news:iH**************@merlyn.demon.co.uk...
<snip> Have also a look on www.javascriptsource.com They have day/date calculators I think. javascriptsource.com may have literally thousands of scripts but when I spent an hour looking through them I was unable to find one that was of a suitable standard to be recommending to anyone. ...
<snip>I didn't take an hour; but I went straight to Calendars : Days left.
In context only the quality of the date/time scripts are significant.
When I was looking at the site I was trying to make an assessment of the
entire collection and given 2000+ scripts I thought a random sample of
more than 100 would be required. Admittedly, when I had dismissed the
first 20 as really very bad I was not optimistic about the prospect of
finding any good scripts on the site, but it did not seem fair to
dismiss the entire collection (publicly) without taking a reasonable
sample.
Richard.
: function MonthLength(y, m) { // NS4 ?
: return new Date(y, m+1, 1, -9).getDate() }
Code that I use to correct the date (in the time stamp on my pages):
// Y2K bugfix for Netscape
if (year<100) year += 2000; else if (year<200) year += 1900;
This should work for the next 95 years :-)
Wouter This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mark |
last post by:
Hi,
We are busy working on Py Issue 7 and 8 and are looking for a few more
article submissions.
Please see our Writers Guidelines at:
http://www.pyzine.com
and get paid to write about...
|
by: Christian Tismer |
last post by:
(re-sent and modified, after I recognized that my
hardware-clock is broken, need a new note-buck)
Dear community,
I would love to publish Stackless 3.1, of course.
Also I know that there is...
|
by: Abby Lee |
last post by:
My code does what I want (works unless there is a lot of
volume...works for this month cause not a lot of items marked paid
yet...) but the page times out for last month because there is just
so...
|
by: JKop |
last post by:
I'm looking for a compiler, I'm running Windows XP. Can anyone suggest a
good one that can output assembly and that has all sorts of good
optimizations in it, all sorts of bells and whistles. I'm...
|
by: Vaughn |
last post by:
I'm looking for a reliable Web Hoster that has full Dot Net functionality.
I'm basically looking for something that's about $10/month or less, has
ASP.Net support, and has positive feedback and...
|
by: Kevin |
last post by:
Hey guys. I'm looking to get together some VB programmers on Yahoo
messenger. I sit at a computer and program all day.
I have about 3 or 4 people already, but it would be really cool to
have a...
|
by: karizmatrix22 |
last post by:
Hi,
I need a programmer who can write 3 programs for following questions below.Programs need to be ready before nextweek.thank you. Person who help me these 3 questions will be get paid.. I am...
|
by: dlschmitt |
last post by:
I looking for help with Maxdb ... I'm looking for someone in the
western states as close to Denver as possilbe. Project Hire. email to
dschmitt@gmail .com or call 800-844-1468 ext 113. ASAP
...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
| |