Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just to add a bit of extra info...</p> <p>Have you thought of using a <a href="http://docs.oracle.com/javase/7/docs/api/" rel="nofollow">Java.utils.Date</a> object?</p> <p>You can construct it with as much, or a little granularity as you desire, eg. from just the 'date' (year:month:day) all the way down to including millisecond time precision.</p> <p>Then you can capture the parts you want with the various getXXX() methods.</p> <p>You have to do a little bit of jiggery pokery by passing your date object into the calendar object (probably by way of a <a href="http://docs.oracle.com/javase/7/docs/api/" rel="nofollow">GregorianCalendar</a>, follow a link there is a nice example on the java doc page).</p> <p>Alternatively you can use your Java.util.Date and pass it to a Java.sql.date by way of the getTime() method of java.util.date.</p> <p>You can do the same with the java.sql.time (ie, pass in the same object and you will end up with just the time portion of your java.util.date object). If you pass the same method to an sql.timestamp it will give the full timestamp.</p> <p>You can also conver back from the timestamp, to either the date or time part using the same procedure (sql.timestamp - to- util.date -to- sql.date (or) sql.time), although most DB's allow casting from one to the other natively.</p> <p>When you pass the getTime() method to your java.util.date object it returns a 'long' value (ie the time since the Unix epoch of 1st jan 1970 !) I don't know how it handles times and dates before this (I assume they are just a 'negative' value ?).</p> <p>You can even store your date in your DB as a long value, if you want to confuse your cliens and obsfuscate your code ;)</p> <p>David</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload