This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Constructing a Date object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Constructing a Date object" Watch "Constructing a Date object" New topic
Author

Constructing a Date object

Varadan Anandanpillai
Greenhorn

Joined: Jul 27, 2001
Posts: 2
Hi,
How do I construct a java.sql.Date or java.util.Date for a specific data, say, June 25th 1995. How do I come with a value for that date in milliseconds? Is there any java utility that does this.
Thanks,
Varadan.
Jason Stortz
Ranch Hand

Joined: Jan 11, 2001
Posts: 68
Varadan,
My topic: java.util.Date

This will print the current date. You can also set the time on myDate with myDate.setTime(newMillisSeconds); or get the time in milli seconds from the date object with myDate.getTime(); which will return a long.
Hope that helps some.
Jason
 
Don't get me started about those stupid light bulbs.
 
subject: Constructing a Date object
 
Similar Threads
date problem
Question on Creation of a Date Object
SimpleDateFormat
Convert sql date to util date
how do I find date difference in months