Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 03-23-2007, 12:30 AM   #1
RedShoe
赤い靴 call me 202-456-1111
 
RedShoe's Avatar
 
Industry Role:
Join Date: Feb 2001
Location: The Valley
Posts: 14,831
Ok, I admit it. I'm stupid, ok, now will you help me? (JAvascript question)

Ok, so I got this JS online, and it works great as is, but then I needed to tweak it a little. So I added +1 to the day, and that worked. It added one day to the output. So I saved it nine times, because I need seperate instances of the date.

Online it was working beautifully. Then just now as the date turned, it went from march 31st, 2007 output as (03/31/2007) to (03/32/2007)



That's no good.

I don't know JS to save my life. Can anyone (smokey) look at this (smokey) and tell me what I did wrong? Or know of a way to fix it (smokey), anyone? (smokey)


var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()+1
if (month<10)
month="0"+month
var daym=mydate.getDate()+9
if (daym<10)
daym="0"+daym
document.write(""+month+"/"+daym+"/"+year+"")
__________________

SPECIALTY COSTUMES • PROPS • FX
Superheroes • Monsters • Robots
PM for details


For any manufacturing needs. Adult or otherwise.

aka BonsHigh on Insta
Bonsai weed plants


RedShoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-23-2007, 12:34 AM   #2
RedShoe
赤い靴 call me 202-456-1111
 
RedShoe's Avatar
 
Industry Role:
Join Date: Feb 2001
Location: The Valley
Posts: 14,831
basically I need a JS that will count days, increasing the day one day for nine days.

you can see where I added +9, that's supposed to take todays date and add 9 days to it. Thus, it should be reading as 04/01/2007, but instead it reads 03/32/2007
__________________

SPECIALTY COSTUMES • PROPS • FX
Superheroes • Monsters • Robots
PM for details


For any manufacturing needs. Adult or otherwise.

aka BonsHigh on Insta
Bonsai weed plants


RedShoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-23-2007, 01:24 AM   #3
RedShoe
赤い靴 call me 202-456-1111
 
RedShoe's Avatar
 
Industry Role:
Join Date: Feb 2001
Location: The Valley
Posts: 14,831
Ok fine. If Smokey doesn't want to help, anyone else can offer their help.
__________________

SPECIALTY COSTUMES • PROPS • FX
Superheroes • Monsters • Robots
PM for details


For any manufacturing needs. Adult or otherwise.

aka BonsHigh on Insta
Bonsai weed plants


RedShoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-23-2007, 01:58 AM   #4
hjnet
Confirmed User
 
Join Date: May 2002
Location: European Union
Posts: 3,815
I honestly don't understand what exactly you're trying to do, but maybe this helps

Code:
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()

var daytemp=mydate.getDate()  // gets todays day
mydate.setDate(daytemp+9)     // adds 9 days and hopefully increments the month
var daym=mydate.getDate()     // gets new day

var month=mydate.getMonth()   // gets new month value, with 9 days added already
if (month<10)
month="0"+month

if (daym<10)
daym="0"+daym
document.write(""+month+"/"+daym+"/"+year+"")
I've not tested it, so it could be that there are some typos built in
And I'm sure there's a better solution to this than using the Date Class, there's for sure a Class that simply allows you to add a specific numer of days to a given date.

If you wanna test it with different dates you can also replace the first line with something like
Code:
var mydate=new Date(year, month, date) 

// year - the year minus 1900.
// month - the month between 0-11.
// date - the day of the month between 1-31.
hjnet is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-23-2007, 02:09 AM   #5
RedShoe
赤い靴 call me 202-456-1111
 
RedShoe's Avatar
 
Industry Role:
Join Date: Feb 2001
Location: The Valley
Posts: 14,831
Thanks I'll definitely give this a shot. Thanks for breaking it down, that will help me tweak it if I need to.
__________________

SPECIALTY COSTUMES • PROPS • FX
Superheroes • Monsters • Robots
PM for details


For any manufacturing needs. Adult or otherwise.

aka BonsHigh on Insta
Bonsai weed plants


RedShoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.