Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Need help writting an expiration date

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I need to write a one year expiration date function. Any sample code would be appreciated, I don't know either to use the date calendar or the SimpleDateFormat? Thanks in advance for any help.
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do something like:

Which will cause the software to expire on January 1, 2004.
Chris
 
bob morkos
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does these parameters mean for:
expires.set(2004,0,1,0,0,0);
The only one that I can guess is 2004. I want to set the expire date one year from the current date.

Originally posted by Chris De Vries:
You can do something like:

Which will cause the software to expire on January 1, 2004.
Chris

 
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
to get a date 1 year from now use the following:
 
Chris De Vries
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Java API docs are a good place to go if you want to find out more about a method call.
Calendar.set(int,int,int,int,int,int) is documented there. The arguments are year, month (starting with 0), date, hour, minute, and second.
[ October 06, 2003: Message edited by: Chris De Vries ]
 
bob morkos
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The date field do they mean the day of the month. Thanks for your reply. But, I'm using jdk1.3.1 and not jdk1.4, can I still use the set calendar function.

Originally posted by Chris De Vries:
The Java API docs are a good place to go if you want to find out more about a method call.
Calendar.set(int,int,int,int,int,int) is documented there. The arguments are year, month (starting with 0), date, hour, minute, and second.
[ October 06, 2003: Message edited by: Chris De Vries ]

 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But, I'm using jdk1.3.1 and not jdk1.4
Use the API at http://java.sun.com/j2se/1.3/docs/api/index.html
This can also be found from http://java.sun.com/docs
 
Whatever. Here's a tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic