File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Date help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Date help" Watch "Date help" New topic
Author

Date help

shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124
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

Joined: Aug 05, 2005
Posts: 3153
    
  10
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 ?


Joanne
shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124
my current date is like 2008-12-03-00.00.00

I am extracting month day and year from the above
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3153
    
  10
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date help
 
Similar Threads
Date problem
How to display date in Daylight Savings
A question on java.util.Date
add one day to current date
formatting challenge using JSpinner