|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Grabbing date...
I am trying to grab todays date to do the following, I am building a query to use on an Oracle database and my two options are:
1) All dates less than or equal to today 2) Todays I am curious how I can get a current date that can also be used in this query... The date format in the database is like so: 2001-10-10 00:00:00.0 |
|
#2
|
|||
|
|||
|
This is tricky for a number of reasons, the main on being that the java.util.Date class is completely different from the java.sql.Date class. Therefore it is much easier to use a timestamp.
The following will get you the current Timestamp: // get the current date as TimeStamp long now = System.currentTimeMillis(); Timestamp nowTS = new Timestamp(now); Now you can refer to this in your SQL statement to get less than or equal to. .:bar:. |
|
#3
|
|||
|
|||
|
I actually figured this out and when I go back to work on Monday I will post my solution...
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > Grabbing date... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|