Java Time and SQL


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Java Time and SQL

  1. #1
    Marc Guest

    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

  2. #2
    Jo Desmet Guest

    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




  3. #3
    Marc Guest

    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center