A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Head First Android
this week in the
Get current date at midnight?
Joined: Jul 06, 2004
Oct 06, 2004 11:26:00
How can I set a variable equal to the current date with the time set to midnight?
In other words, each time my program runs, I want:
myDate = MM/dd/yyyy 00:00:00
Where MM/dd/yyyy is the current date.
Joined: Feb 18, 2003
Oct 06, 2004 13:16:00
Create an object of gregorian calender. You can create a date object using individual ints for the different month, day, ....
Joined: Apr 02, 2004
Oct 06, 2004 20:28:00
Jeremy had already given you the clue to get started.
Since you need the current date, your best bet would be the system date, that will always give you today's (current) date.
class, you're able to get this current date. Hint: look at its constructor.
Your second part involves
ting your time components, namely
into 0s. So there must be some way (methods) that can help you to do the
will be able to help you get all the pieces together into your desired codes.
SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
I agree. Here's the link:
subject: Get current date at midnight?
how to change the date,Time format after accessing it from the database
Insert a row into MS Access2003 successfully,But the long date(YYYY/MM/DD HH:mm:ss) was changed
Trying to see if incoming date parameter has a time attached or not (wwithout using midnight)
String to Date conversion very frustrating
Date comparision in SQL from timestamp
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015