home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 2681
Discussions: 188,384, Posts: 2,243,493, Members: 232,612
Old February 13th, 2003, 05:45 PM   Digg it!   #1 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 6,163
Send a message via ICQ to Creatures
Question
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

Creatures is online now   Reply With Quote
Old February 13th, 2003, 05:47 PM     #2 (permalink)
Best To Avoid Me
 
Martoch's Avatar
 
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 ~

Martoch is offline   Reply With Quote
Old February 13th, 2003, 05:52 PM     #3 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 6,163
Send a message via ICQ to Creatures
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

Creatures is online now   Reply With Quote
Old February 13th, 2003, 05:54 PM     #4 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 6,163
Send a message via ICQ to Creatures
and it doesnt work put in

month 2
day 26
year 2003

it's not correct!! ( y2k bug!)

Creatures
Creatures is online now   Reply With Quote
Old February 13th, 2003, 08:06 PM     #5 (permalink)
Banned
 
qball's Avatar
 
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.
qball is offline   Reply With Quote
Old February 14th, 2003, 01:34 AM     #6 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 6,163
Send a message via ICQ to Creatures
well i want to create a program which works on a calculater ( ti-83 +)

Creatures
Creatures is online now   Reply With Quote
Old 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.
Creosote is offline   Reply With Quote
Old February 14th, 2003, 01:04 PM     #8 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 6,163
Send a message via ICQ to Creatures
i think i've got an idea!

i will post if it works!!

Creatures
Creatures is online now   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Most Active Discussions
Is It Just Me? (2892)
The United States Debt (20)
3-days in and no threads about Gaza (160)
I think I just killed my computer w.. (24)
Upgrading RAM (5)
hp compaq nc6000 problems (138)
Folderchat Weekday thread (441)
Antec 300 bulk purchase? (11)
Worth the upgrade?? (15)
Recent Discussions
Building a gaming computer advi.. (3)
Worth the upgrade?? (15)
Folderchat Weekday thread (441)
ADVICE (0)
How to increase my ram? (5)
Help with an Ati Radeon HD 4850.. (27)
CPU wont boot (4)
2nd video card (1)
special characters in quarkxpre.. (3)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 09:44 PM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28