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 10-30-2003, 04:04 AM   #1
the Grandad
Confirmed User
 
Join Date: Aug 2003
Location: the Retirement Home (Almost)
Posts: 1,038
How do I display Yesterday's Date using J-Script?

I know how to display todays date but I am having trouble adding yesterdays date

anyone know how?
the Grandad is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-30-2003, 04:04 AM   #2
twistyneck
So Fucking Banned
 
Join Date: Jan 2002
Location: Hanging by the neck until dead.
Posts: 4,660
Can't be done. Quit now.
twistyneck is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-30-2003, 04:05 AM   #3
johnbosh
Confirmed User
 
Join Date: Aug 2002
Location: The Netherlands, Rotterdam
Posts: 8,965
Quote:
Originally posted by twistyneck
Can't be done. Quit now.
It can be done, used some javacript to display the date and added -1 somewhere and it worked:D
johnbosh is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-30-2003, 04:07 AM   #4
the Grandad
Confirmed User
 
Join Date: Aug 2003
Location: the Retirement Home (Almost)
Posts: 1,038
Quote:
Originally posted by twistyneck
Can't be done. Quit now.
damn
the Grandad is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-30-2003, 04:13 AM   #5
SMG
Confirmed User
 
Join Date: Aug 2003
Posts: 1,798
for this I would just have php do it, and then make the php print JS code but you could do something like this:
get a date object:
now = new Date();

get the parts off of it:

var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
var monthnumber = now.getMonth();
var monthday = now.getDate();
var year = now.getYear() + 1900;

setup an array:
var monthlens = array(12);
monthlens[0] = 31;
monthlens[1] = 30;
... and so on for the 12 months, putting in the lengths ...
then do:
if (monthday hahahaha 1) and monthnumber hahahaha 0) {
year--;
monthnumber = 12;
}
if (monthday hahahaha 1) {
monthday = monthlens[monthnumber-1];
monthnumber = monthnumber - 1;
}

I wrote this in the reply box and didnt test it but if I'm right it has almost all the checks to get yesterday's date (except leap year code...) ... I still think php echo date('M d Y',time()-86400) is easier though ...
__________________
TGP Webmasters: sign up for the top 100 tgp list!
Submit galleries
If you add me to icq (title) make sure to mention GFY or I'll think you're a bot and deny you.
SMG is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-30-2003, 04:16 AM   #6
SMG
Confirmed User
 
Join Date: Aug 2003
Posts: 1,798
oops, the "hahaha"s are supposed to be 2 = signs back to back dunno why thats filtered and in that first if statement it should be && not and
__________________
TGP Webmasters: sign up for the top 100 tgp list!
Submit galleries
If you add me to icq (title) make sure to mention GFY or I'll think you're a bot and deny you.
SMG is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-30-2003, 04:24 AM   #7
the Grandad
Confirmed User
 
Join Date: Aug 2003
Location: the Retirement Home (Almost)
Posts: 1,038
Quote:
Originally posted by SMG
oops, the "hahaha"s are supposed to be 2 = signs back to back dunno why thats filtered and in that first if statement it should be && not and
thanks but It didn't seem to work
the Grandad 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.