Subject Re: DATE VALUE in SQL
From Mervyn Bick <invalid@invalid.invald>
Date Thu, 15 Nov 2018 21:54:30 +0200
Newsgroups dbase.getting-started

On 2018-11-15 8:05 PM, Mustansir Ghor wrote:
> Dear Mervyn
>
> Thanks. when I enter in dd/mm/yyyy. it generates error (see attach file). But when I enter in mm/dd/yyyy format it accept it.
>
> Example
> insert into dissales (sdate) values("11/15/2018")
>
> Pls can try this. May be there is something I am missing.

As I said in the previous message, localSQL requires dates to be literal
values in either American ('mm/dd/yyyyy') or German ('dd.mm.yyyy')
format no matter what date format you use on your computer.

insert into dissales (sdate) values("11/15/2018") works because the date
is in American format.

insert into dissales (sdate) values("15.11.2018") would also work as the
date is in German format.

Because you have your date format set to British ctod(date()) will give
you 15/11/2018 which is not acceptable to localSQL.

My suggestion was that you temporarily change the date format to
American then use dtoc() to get the character value of sdate which is
then stored in mdate1.  Immediately after this set the date format back
to British so that you don't upset anything else in your program.

The value in mdate1 is a character string in American format and setting
the date format to British won't affect it.   You can now build it into
your SQL command where it needs to be wrapped in quotes.

Mervyn.