-
Java Time and SQL
Hi,
My questions are
1) Does Java provide a class to read the computer's date and time such
that I could then use that to compare it to another time and date object
for the purpose of seeing which events have passed already.
2) How do I sort a table using SQL using criteria I set up? And how then
can I insert into the right location a new entry into the table using Java
and SQL?
Thanks
Marc
-
Re: Java Time and SQL
1./ Yes Java Does: "new Date( )" returns a Date object containing current
date and time. For extracting the actual numbers out of it, you will
probably want to use a DateFormat (as it has to take the timezone into
account because Date is timezone independent).
2./ "SELECT x x x FROM x ORDER BY x" will show your table ordered as you
define, mind here that a table is not phyisicly ordered by using this
statement, It only has influence in what is represented to you. Because of
that there is no such thing as "inserting into the right location" because
that is up to the database engine to decide where it will be physically
stored (propbably the next available position). Thats how databases work.
"Marc" <MarcM@cyberrebate.com> wrote in message
news:3981de22$1@news.devx.com...
>
> Hi,
>
> My questions are
> 1) Does Java provide a class to read the computer's date and time such
> that I could then use that to compare it to another time and date object
> for the purpose of seeing which events have passed already.
>
> 2) How do I sort a table using SQL using criteria I set up? And how
then
> can I insert into the right location a new entry into the table using Java
> and SQL?
>
> Thanks
>
> Marc
-
Re: Java Time and SQL
Thanks very much for the information.
Marc
"Jo Desmet" <jo_desmet@yahoo.com> wrote:
>1./ Yes Java Does: "new Date( )" returns a Date object containing current
>date and time. For extracting the actual numbers out of it, you will
>probably want to use a DateFormat (as it has to take the timezone into
>account because Date is timezone independent).
>2./ "SELECT x x x FROM x ORDER BY x" will show your table ordered as you
>define, mind here that a table is not phyisicly ordered by using this
>statement, It only has influence in what is represented to you. Because
of
>that there is no such thing as "inserting into the right location" because
>that is up to the database engine to decide where it will be physically
>stored (propbably the next available position). Thats how databases work.
>
>"Marc" <MarcM@cyberrebate.com> wrote in message
>news:3981de22$1@news.devx.com...
>>
>> Hi,
>>
>> My questions are
>> 1) Does Java provide a class to read the computer's date and time such
>> that I could then use that to compare it to another time and date object
>> for the purpose of seeing which events have passed already.
>>
>> 2) How do I sort a table using SQL using criteria I set up? And how
>then
>> can I insert into the right location a new entry into the table using
Java
>> and SQL?
>>
>> Thanks
>>
>> Marc
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks