February 13th, 2003, 05:45 PM
|
#1 (permalink)
| | Go back to sleep
Join Date: Jul 2002 Location: Switzerland
Posts: 6,163
| Calculate the Day? (mon, tue, wed...)
i want to calculate a special day (ex. 26.02.1987) and i want to know which day of the week it is! (ex. Thursday)
i've got a program which calculates the dates between 2000 and 2099 so are there other methods?? (i dont want to get the system date nor a calendar!)
Creatures
__________________ Canon EOS 450D | Canon EF-S 18-55mm 1:3.5-5.6 IS | Canon EF-S 55-250mm 1:4-5.6 IS | Canon Speedlite 430EX II |
| |
February 13th, 2003, 05:47 PM
|
#2 (permalink)
| | Best To Avoid Me
Join Date: Mar 2002 Location: Under Your Bed
Posts: 8,596
|
Will this be good enough for you buddy? Quote: | Use this calculator to find the day of week for any genealogical date occurring after 1582 | Day Calculator
__________________
~ Camp Crystal Lake counselor positions opening daily ~
|
| |
February 13th, 2003, 05:52 PM
|
#3 (permalink)
| | Go back to sleep
Join Date: Jul 2002 Location: Switzerland
Posts: 6,163
|
cool but i have to get this javascript : Quote:
<!--
function cala_day(form) {
var nSwitch = 0
var nMonth = parseInt(form.month.value)
var nDay = parseInt(form.day.value)
var nYear = parseInt(form.year.value)
if(!(nYear % 4) && (nMonth > 2)) {
nSwitch = 1
}
var nDayOfWeek = cala_weekday(nMonth, nDay, nYear)
if(nSwitch) {
nDayOfWeek++
nSwitch = 0
}
day_display(form, nDayOfWeek)
}
function cala_weekday( x_nMonth, x_nDay, x_nYear) {
if(x_nMonth >= 3){
x_nMonth -= 2
}
else {
x_nMonth += 10
}
if( (x_nMonth == 11) || (x_nMonth == 12) ){
x_nYear--
}
var nCentNum = parseInt(x_nYear / 100)
var nDYearNum = x_nYear % 100
var nPart1 = parseInt(2.6 * x_nMonth - .2)
var nZeller = (parseInt(nPart1 + x_nDay + nDYearNum + (nDYearNum / 4) + (nCentNum / 4) - 2 * nCentNum)) % 7
if(nZeller < 0){
nZeller += 7
}
return nZeller
}
function day_display(form, x_nDayOfWeek) {
if(x_nDayOfWeek == 0) {
form.birthday.value = "Saturday"
return
}
if(x_nDayOfWeek == 1) {
form.birthday.value = "Sunday"
return
}
if(x_nDayOfWeek == 2) {
form.birthday.value = "Monday"
return
}
if(x_nDayOfWeek == 3) {
form.birthday.value = "Tuesday"
return
}
if(x_nDayOfWeek == 4) {
form.birthday.value = "Wednesday"
return
}
if(x_nDayOfWeek == 5) {
form.birthday.value = "Thursday"
return
}
if(x_nDayOfWeek == 6) {
form.birthday.value = "Friday"
return
}
form.birthday.value = "Not a valid date."
}
//-->
| Creatures |
| |
February 13th, 2003, 05:54 PM
|
#4 (permalink)
| | Go back to sleep
Join Date: Jul 2002 Location: Switzerland
Posts: 6,163
|
and it doesnt work put in
month 2
day 26
year 2003
it's not correct!! ( y2k bug!)
Creatures |
| |
February 13th, 2003, 08:06 PM
|
#5 (permalink)
| | Banned
Join Date: Oct 2001
Posts: 447
|
no, it doesn't seems to be a day off...
Can't you simply create a Date object by:
new Date(datestring);
new Date(year, month, day);
and then simply call the getDay() method?
yes you can. getDay() returns 0=Sunday thru 6=Saturday. |
| |
February 14th, 2003, 01:34 AM
|
#6 (permalink)
| | Go back to sleep
Join Date: Jul 2002 Location: Switzerland
Posts: 6,163
|
well i want to create a program which works on a calculater ( ti-83 +)
Creatures |
| |
February 14th, 2003, 02:27 AM
|
#7 (permalink)
| | Member
Join Date: Sep 2002
Posts: 364
|
Pick some odd day in the past that you probably wouldn't want to calculate for that starts on Sunday. The date that you use, subtract the orignal starting date from that to see how many days have elapsed.
Then divide by and add the remainder to get the day.
I don't know what Ti-83 uses. I have one of those. I should check into too....seein as how they cost $100, I might as well do something cool with it. I lost my book though.
Anyways, if it is capable of creating a data "data type" or object, one might assume there is functionality for subtracting one date from another, and possible even a getDay() function as stated above.
If not, and you're just working with integers or something, you would have to take into consideration leap years, etc. |
| |
February 14th, 2003, 01:04 PM
|
#8 (permalink)
| | Go back to sleep
Join Date: Jul 2002 Location: Switzerland
Posts: 6,163
|
i think i've got an idea!
i will post if it works!!
Creatures |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | |
Posting Rules
| You may post new threads You may post replies You may not post attachments You may not edit your posts HTML code is Off | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |