Board index » delphi » Date format with the SQL queries

Date format with the SQL queries

I have problems with the format when the day is greater than 12 . Delphi
gives me the error : Date not exist. Can someone help em with this
problem ?

Thank in advance , yours sincerely :
 Alfonso Castro
 alfo...@udc.es

P.D: Best regards!!

 

Re:Date format with the SQL queries


Re: Date format with the SQL queries

1) Check your date configuration in your system :
       AA-MM-JJ
   or  JJ-MM-AA
   or  AA-JJ-MM
   or  .....

   if you have AA-JJ-MM configuration and you set a date to
   96-06-26  ----> error month is between 1..12 (not a day)

2) You can use this function in SQL queries :

   CharToDate('96-02-19','YY-MM-DD')

   (Me I use Oracle DataBase)

Re:Date format with the SQL queries


Quote
Alfonso Castro Martinez wrote:

> I have problems with the format when the day is greater than 12 . Delphi
> gives me the error : Date not exist. Can someone help em with this
> problem ?

You're probably swapping the day & month values.  The easiest way I've
found to handle dates is to use a parameter in the query, and use the
AsDateTime to set it.

  -- Paul Leskinen

Re:Date format with the SQL queries


Quote
>I have problems with the format when the day is greater than 12Hi Alfonso,

I suspect that what YOU think is the DAY, SQL thinks is the MONTH,
so once it gets over 12 it is invalid.

I had problems with date formats in SQL- supposedly you can
set which format is is using in the BDE Configuration utility,
but I can't get it to change. It SHOULD set itself at Delphi
install time to your Windows Short Date format.

My SQL is using MM/DD/YYYY and my Windows and everything I do uses
YYYY/MM/DD, so I flip the pieces of any dates I pass to SQL.

John Hall / Digital Magic <ha...@cadvision.com>

Re:Date format with the SQL queries


In article <316BE488.41C67...@udc.es> Alfonso Castro Martinez <alfo...@udc.es> writes:

Quote
>From: Alfonso Castro Martinez <alfo...@udc.es>
>Subject: Date format with the SQL queries
>Date: Wed, 10 Apr 1996 18:40:40 +0200
>I have problems with the format when the day is greater than 12 . Delphi
>gives me the error : Date not exist. Can someone help em with this
>problem ?
>Thank in advance , yours sincerely :
> Alfonso Castro
> alfo...@udc.es
>P.D: Best regards!!

This is to do with how Windows expects the date to be formatted. In WFW 3.11
use control panel, date time to set the date format from the American M/D/Y to
whatever format you want.

In theory anyway - the DBE sometimes still gets confused though

HTH

Boris Ingram, Cyborg Software
boris...@iafrica.com
Compuserve : 100076, 3616
http://www.pcb.co.za/users/borising/cyborg.htm

Re:Date format with the SQL queries


Quote
Alfonso Castro Martinez wrote:

> I have problems with the format when the day is greater than 12 . Delphi
> gives me the error : Date not exist. Can someone help em with this
> problem ?

> Thank in advance , yours sincerely :
>  Alfonso Castro
>  alfo...@udc.es

> P.D: Best regards!!Please describe your problem in more detail.  Don't think I know where

to start with that explanation.

Re:Date format with the SQL queries


Alfonso Castro Martinez <alfo...@udc.es> wrote:

Quote
>I have problems with the format when the day is greater than 12 . Delphi
>gives me the error : Date not exist. Can someone help em with this
>problem ?
>Thank in advance , yours sincerely :
> Alfonso Castro
> alfo...@udc.es
>P.D: Best regards!!

I think you are using dates in "dd/mm/yy" format.

In a TQuery you must write "mm/dd/yy" dates.

I don't know any workaround.

Un saludo
  Francisco

Other Threads