SunQuest
           Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old October 15th, 2001, 01:24 PM
hyrum hyrum is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Location: Kitchener, Ontario, Canada
Posts: 31 hyrum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 8 sec
Reputation Power: 8
Send a message via ICQ to hyrum
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

Reply With Quote
  #2  
Old October 24th, 2001, 06:51 PM
bar bar is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Location: Dublin, Ireland
Posts: 0 bar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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:.

Reply With Quote
  #3  
Old October 25th, 2001, 09:40 AM
hyrum hyrum is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Location: Kitchener, Ontario, Canada
Posts: 31 hyrum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 8 sec
Reputation Power: 8
Send a message via ICQ to hyrum
I actually figured this out and when I go back to work on Monday I will post my solution...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Grabbing date...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway