List:General Discussion« Previous MessageNext Message »
From:Pal Wester Date:February 19 2001 5:25pm
Subject:SV: Comparing dates
View as plain text  
Actually, there should be a function which does the oposite
of the DATE_FORMAT function, ie. converting a string to date.

but as long as you use mysql notation on dates, you can write
...WHERE myDateField > '2001-02-14';

As I'm in norway and wriote norwegian applications I usually get dates
on the form dd.mm.yyyy and have to convert it into yyyy-mm-dd in
programming before the sqlstatement... so a TO_DATE('14.02.2001',
'dd.mm.yyyy')
like oracle would be nice...

mvh:
Pal Wester, programmerer
never.no as, stortingsgt 30, 0161 Oslo
tlf: 22 01 66 20, fax: 22 01 66 21
direkte: 22 01 66 34, 906 900 62
http://never.no - icq:103476059
~ hvis du ikke klarer det pa sorste forsok vil jeg ikke anbefale hangliding
~

> -----Opprinnelig melding-----
> Fra: Nick Didkovsky [mailto:drnerve@stripped]
> Sendt: 19. februar 2001 14:53
> Til: mysql
> Emne: Comparing dates
>
>
> Hello,
>
> Is there a more general way to compare DATE values than the following.
>
> ...WHERE TO_DAYS(myDateField) > TO_DAYS('2001-02-14');
>
>
> I really have to objection to converting to a common unit of days in
> order to compare (as long as I don't care about comparing times within
> the same day), but I imagined there would be a more general DATE type
> that could be compared uniformly, and a hypothetical TO_DATE() function
> that would cast appropriately.
>
> Something that would accomodate the following:
>
> ...WHERE TO_DATE(myDateField) > TO_DATE('1997-10-04 22:23:00')
>
> as well as:
>
> ...WHERE TO_DATE(myDateField) > TO_DATE('1997-10-04')
>
> You get the idea... thoughts?
>
> Best,
> Nick
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <mysql-thread65759@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-pal.wester.list=dev.never.no@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Thread
Comparing datesNick Didkovsky19 Feb
  • Re: Comparing datesPeter Skipworth19 Feb
    • Error 127Lauri Vain19 Feb
      • Re: Error 127Bob Hall20 Feb
  • SV: Comparing datesPal Wester19 Feb
    • Re: SV: Comparing datesNick Didkovsky19 Feb