• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date help

 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to display page depending on dates

between todays date and June 15 2009 ---I need to display page1.htm

after june 15 2009 I need to display page2.htm

here is what I have done: get

month =Integer.parseInt(sdf.format(currdate));
day =Integer.parseInt(sdf.format(currdate));
year =Integer.parseInt(sdf.format(currdate));

if( (month>=6)&& (day>=1) &&(year!=2008)){
show page1.htm
else
show page2.htm

This is not working if i have current date as Jan 11 2010
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shah rah:
I need to display page depending on dates

between todays date and June 15 2009 ---I need to display page1.htm

after june 15 2009 I need to display page2.htm

here is what I have done: get

month =Integer.parseInt(sdf.format(currdate));
day =Integer.parseInt(sdf.format(currdate));
year =Integer.parseInt(sdf.format(currdate));

if( (month>=6)&& (day>=1) &&(year!=2008)){
show page1.htm
else
show page2.htm

This is not working if i have current date as Jan 11 2010


You're calling the same methods with the same data to calculate month, day and year. Won't this make month, day and year all have the same value ?
 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my current date is like 2008-12-03-00.00.00

I am extracting month day and year from the above
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shah rah:
my current date is like 2008-12-03-00.00.00

I am extracting month day and year from the above


I would expect these three lines of codeto set month, day and year to the same value, so the first thing you should check is whether the values of those 3 variables are what you expect them to be.
[ December 03, 2008: Message edited by: Joanne Neal ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic