Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #27749 > unrolled thread
| Started by | Navneet Mathpal <navneetmathpal93@gmail.com> |
|---|---|
| First post | 2014-03-13 08:16 -0700 |
| Last post | 2014-03-14 22:11 +0000 |
| Articles | 4 — 3 participants |
Back to article view | Back to comp.lang.java.programmer
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
| From | Navneet Mathpal <navneetmathpal93@gmail.com> |
|---|---|
| Date | 2014-03-13 08:16 -0700 |
| Subject | how to compare date and get latest one |
| Message-ID | <374d2575-df01-45de-8267-4c9b579e56be@googlegroups.com> |
hi , For insertion of time i am using Date date=new Date(); all the date are getting inserted in mongodb. now i want the latest time and date from those record which i have inserted how can i do this using java, I am using spring framework
[toc] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2014-03-13 23:42 -0700 |
| Message-ID | <p695i99v87dkgvp8nbafplokjrsiv5afve@4ax.com> |
| In reply to | #27749 |
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. -- Roedy Green Canadian Mind Products http://mindprod.com "Incorrect documentation is often worse than no documentation." ~ Bertrand Meyer (born: 1950 age: 63), creator of design by contract and the Eiffel language.
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Date | 2014-03-14 21:20 +0000 |
| Message-ID | <lfvrql$s2o$1@dont-email.me> |
| In reply to | #27755 |
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 |
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Date | 2014-03-14 22:11 +0000 |
| Message-ID | <lfvupr$r4f$1@dont-email.me> |
| In reply to | #27764 |
On Fri, 14 Mar 2014 21:20:21 +0000, Martin Gregorie wrote:
Note the correction for the previous message:
> 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
^^^^^^^^^^^^^
java.util.Date
--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web