LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to compare date string?? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-compare-date-string-603371/)

loplayers 11-29-2007 07:58 PM

how to compare date string??
 
i have query two date from database to two variables a and b;
a:2007-12-01 01:00:00
b:2007-11-31 22:00:00

i want to compare two date that which one is the latest day?
so how can i do with using if command or other command??

kaz2100 11-29-2007 08:40 PM

Hya,

If you are using C, strptime() may be what you want.

If 3 min past 7 o'clock January 1st 2007 is 2007-01-01 07:03:00 (note leading zero), just comparing them in character string may be good enough.

Hope this helps.

Happy Penguins!


All times are GMT -5. The time now is 10:35 AM.