GEC: Discuss gaming, computers and electronics and venture into the bizarre world of STGODs.
Moderator: Thanas
haas mark
Official SD.Net Insomniac
Posts: 16533 Joined: 2002-09-11 04:29pm
Location: Wouldn't you like to know?
Contact:
Post
by haas mark » 2003-12-10 09:36am
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
<!--
dayName = new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
monName = new Array ("January","February","March","April","May","June","July","August","September","October","November","December")
now = new Date
// -->
</script>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
document.write(dayName[now.getDay()] + ", " + monName[now.getMonth()] + " " + now.getDate() + ".")
// -->
</script>
</body>
</html>
Okay, basic code for a current date. Is there ANY WAY to set this so it advances to TOMORROW'S date instead of TODAY'S?
~ver
Robert-Conway.com | lunar sun | TotalEnigma.net
Hot Pants à la Zaia | BotM Lord Monkey Mod OOK!
SDNC | WG | GDC | ACPATHNTDWATGODW | GALE | ISARMA | CotK: [mew]
Formerly verilon
R.I.P. Eddie Guerrero, 09 October 1967 - 13 November 2005
Dalton
For Those About to Rock We Salute You
Posts: 22637 Joined: 2002-07-03 06:16pm
Location: New York, the Fuck You State
Contact:
Post
by Dalton » 2003-12-10 09:42am
Try this:
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
<!--
dayName = new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
monName = new Array ("January","February","March","April","May","June","July","August","September","October","November","December")
now = new Date
tom = now.getDate()+1
// -->
</script>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
document.write(dayName[now.getDay()+1] + ", " + monName[now.getMonth()] + " " + tom + ".")
// -->
</script>
</body>
</html>
To Absent Friends
Dalton | Admin Smash | Knight of the Order of SDN
"y = mx + bro " - Surlethe
"You try THAT shit again, kid, and I will mod you. I will
mod you so hard, you'll wish I were Dalton." - Lagmonster
May the way of the Hero lead to the Triforce.
haas mark
Official SD.Net Insomniac
Posts: 16533 Joined: 2002-09-11 04:29pm
Location: Wouldn't you like to know?
Contact:
Post
by haas mark » 2003-12-10 09:47am
Thanks.
~ver
Robert-Conway.com | lunar sun | TotalEnigma.net
Hot Pants à la Zaia | BotM Lord Monkey Mod OOK!
SDNC | WG | GDC | ACPATHNTDWATGODW | GALE | ISARMA | CotK: [mew]
Formerly verilon
R.I.P. Eddie Guerrero, 09 October 1967 - 13 November 2005
Dalton
For Those About to Rock We Salute You
Posts: 22637 Joined: 2002-07-03 06:16pm
Location: New York, the Fuck You State
Contact:
Post
by Dalton » 2003-12-10 09:49am
verilon wrote: Thanks.
Sure. You might need to hack it a bit more to advance the month on 28, 29, 30 or 31.
To Absent Friends
Dalton | Admin Smash | Knight of the Order of SDN
"y = mx + bro " - Surlethe
"You try THAT shit again, kid, and I will mod you. I will
mod you so hard, you'll wish I were Dalton." - Lagmonster
May the way of the Hero lead to the Triforce.
haas mark
Official SD.Net Insomniac
Posts: 16533 Joined: 2002-09-11 04:29pm
Location: Wouldn't you like to know?
Contact:
Post
by haas mark » 2003-12-10 09:51am
Dalton wrote: verilon wrote: Thanks.
Sure. You might need to hack it a bit more to advance the month on 28, 29, 30 or 31.
Ok.. since I'm pretty much JS-illiterate for the most part, how might I go about doing this? (My little book here doesn't explain that much into current dates.)
~ver
Robert-Conway.com | lunar sun | TotalEnigma.net
Hot Pants à la Zaia | BotM Lord Monkey Mod OOK!
SDNC | WG | GDC | ACPATHNTDWATGODW | GALE | ISARMA | CotK: [mew]
Formerly verilon
R.I.P. Eddie Guerrero, 09 October 1967 - 13 November 2005
Dalton
For Those About to Rock We Salute You
Posts: 22637 Joined: 2002-07-03 06:16pm
Location: New York, the Fuck You State
Contact:
Post
by Dalton » 2003-12-10 09:56am
Well, it's pretty much a bit of mix and match. If you, say, take the raw array value from the script for the month and filter that through a new array consisting of a list of end dates, you can take THAT result and make an if-then statement like
Code: Select all
if (now.getDate == EndDatevariable) then month == now.getMonth()+1
Of course, there's a lot more hacking to do if you want to make it leap-year friendly...but that's a pain in the ass.
To Absent Friends
Dalton | Admin Smash | Knight of the Order of SDN
"y = mx + bro " - Surlethe
"You try THAT shit again, kid, and I will mod you. I will
mod you so hard, you'll wish I were Dalton." - Lagmonster
May the way of the Hero lead to the Triforce.
haas mark
Official SD.Net Insomniac
Posts: 16533 Joined: 2002-09-11 04:29pm
Location: Wouldn't you like to know?
Contact:
Post
by haas mark » 2003-12-10 10:03am
Dalton wrote: Well, it's pretty much a bit of mix and match. If you, say, take the raw array value from the script for the month and filter that through a new array consisting of a list of end dates, you can take THAT result and make an if-then statement like
Code: Select all
if (now.getDate == EndDatevariable) then month == now.getMonth()+1
Of course, there's a lot more hacking to do if you want to make it leap-year friendly...but that's a pain in the ass.
-blinks- Huh? Note: I FAILED my Java class at uni because I didn't understand arrays..
~ver
Robert-Conway.com | lunar sun | TotalEnigma.net
Hot Pants à la Zaia | BotM Lord Monkey Mod OOK!
SDNC | WG | GDC | ACPATHNTDWATGODW | GALE | ISARMA | CotK: [mew]
Formerly verilon
R.I.P. Eddie Guerrero, 09 October 1967 - 13 November 2005
Dalton
For Those About to Rock We Salute You
Posts: 22637 Joined: 2002-07-03 06:16pm
Location: New York, the Fuck You State
Contact:
Post
by Dalton » 2003-12-10 10:11am
verilon wrote: -blinks- Huh? Note: I FAILED my Java class at uni because I didn't understand arrays..
Alright...let me do some quick hacking. Back in a flash.
To Absent Friends
Dalton | Admin Smash | Knight of the Order of SDN
"y = mx + bro " - Surlethe
"You try THAT shit again, kid, and I will mod you. I will
mod you so hard, you'll wish I were Dalton." - Lagmonster
May the way of the Hero lead to the Triforce.
Dalton
For Those About to Rock We Salute You
Posts: 22637 Joined: 2002-07-03 06:16pm
Location: New York, the Fuck You State
Contact:
Post
by Dalton » 2003-12-10 10:49am
Gonna require a lot of special commands just to make sure you don't get an "undefined" error...
To Absent Friends
Dalton | Admin Smash | Knight of the Order of SDN
"y = mx + bro " - Surlethe
"You try THAT shit again, kid, and I will mod you. I will
mod you so hard, you'll wish I were Dalton." - Lagmonster
May the way of the Hero lead to the Triforce.
Dalton
For Those About to Rock We Salute You
Posts: 22637 Joined: 2002-07-03 06:16pm
Location: New York, the Fuck You State
Contact:
Post
by Dalton » 2003-12-10 10:57am
See what this does for you.
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
<!--
dayName = new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
monName = new Array ("January","February","March","April","May","June","July","August","September","October","November","December");
endDate = new Array ("31","28","31","30","31","30","31","31","30","31","30","31");
now = new Date();
tod = now.getDate();
tom = now.getDate()+1;
tom2 = dayName[now.getDay()+1];
mon = monName[now.getMonth()];
mon2 = monName[now.getMonth()+1];
mon3 = monName[now.getMonth()-11];
endDateNow = endDate[now.getMonth()];
if (now.getYear()%4 == 0 && now.getMonth()==1) {endDateNow=29};
if (now.getDate() == endDateNow) {mon=mon2};
if (now.getDate()+1 > endDateNow) {tom=tom-endDateNow};
if (now.getMonth() == 11 && now.getDate()+1 > endDateNow) {mon=mon3};
if (now.getDay()+1 > 6) {tom2 = dayName[now.getDay()-6]};
// -->
</script>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
document.write(tom2 + ", " + mon + " " + tom + ".")
// -->
</script>
</body>
</html>
To Absent Friends
Dalton | Admin Smash | Knight of the Order of SDN
"y = mx + bro " - Surlethe
"You try THAT shit again, kid, and I will mod you. I will
mod you so hard, you'll wish I were Dalton." - Lagmonster
May the way of the Hero lead to the Triforce.
haas mark
Official SD.Net Insomniac
Posts: 16533 Joined: 2002-09-11 04:29pm
Location: Wouldn't you like to know?
Contact:
Post
by haas mark » 2003-12-10 11:27am
Seems to work fine. MANY thanks!
Seems today will be a good day yet..
~ver
Robert-Conway.com | lunar sun | TotalEnigma.net
Hot Pants à la Zaia | BotM Lord Monkey Mod OOK!
SDNC | WG | GDC | ACPATHNTDWATGODW | GALE | ISARMA | CotK: [mew]
Formerly verilon
R.I.P. Eddie Guerrero, 09 October 1967 - 13 November 2005
Dalton
For Those About to Rock We Salute You
Posts: 22637 Joined: 2002-07-03 06:16pm
Location: New York, the Fuck You State
Contact:
Post
by Dalton » 2003-12-10 11:31am
verilon wrote: Seems to work fine. MANY thanks!
Seems today will be a good day yet..
Glad I could help! Let me know if it chokes on any particular date.
To Absent Friends
Dalton | Admin Smash | Knight of the Order of SDN
"y = mx + bro " - Surlethe
"You try THAT shit again, kid, and I will mod you. I will
mod you so hard, you'll wish I were Dalton." - Lagmonster
May the way of the Hero lead to the Triforce.