Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #27764

Re: how to compare date and get latest one

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: how to compare date and get latest one
Date 2014-03-14 21:20 +0000
Organization A noiseless patient Spider
Message-ID <lfvrql$s2o$1@dont-email.me> (permalink)
References <374d2575-df01-45de-8267-4c9b579e56be@googlegroups.com> <p695i99v87dkgvp8nbafplokjrsiv5afve@4ax.com>

Show all headers | View raw


On Thu, 13 Mar 2014 23:42:54 -0700, Roedy Green wrote:

> On Thu, 13 Mar 2014 08:16:32 -0700 (PDT), Navneet Mathpal
> <navneetmathpal93@gmail.com> wrote, quoted or indirectly quoted someone
> who said :
> 
>>For insertion of time i am using Date date=new Date();
> 
> don't Dates implement Comparable?
> 
> I don't know about Spring.

Give or take a method or two java.util.Date and java.sql.Date are 
effectively the same; java.sql.Date is an extension of java.sql.date as 
is clearly stated in the standard class library documentation.

IOW, both hold dates as milliseconds since January 1, 1970 00:00:00.000 
GMT, which is both the UNIX base date and the SQL Standard base date. IOW 
you can do simple comparisons by using the methods defined in 
java.util.Date, but for anything more complex than that I use the methods 
in java.date.GregorianCalendar and I use java.textSimpleDateFormat for 
formatting and parsing date strings, i.e. all conversions between Date 
and String objects.
 

-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

how to compare date and get latest one Navneet Mathpal <navneetmathpal93@gmail.com> - 2014-03-13 08:16 -0700
  Re: how to compare date and get latest one Roedy Green <see_website@mindprod.com.invalid> - 2014-03-13 23:42 -0700
    Re: how to compare date and get latest one Martin Gregorie <martin@address-in-sig.invalid> - 2014-03-14 21:20 +0000
      Re: how to compare date and get latest one Martin Gregorie <martin@address-in-sig.invalid> - 2014-03-14 22:11 +0000

csiph-web