Subject Re: date conversion for mysql
From Mervyn Bick <invalid@invalid.invald>
Date Fri, 11 Jan 2019 12:51:50 +0200
Newsgroups dbase.getting-started

On 2019-01-11 5:57 AM, Charlie wrote:
> Hi Mervyn... Thanks.. I'll try that.  I came up with one for xdml although it isn't tested.  Think this will work?
> datestring = dtos(date())
> yearstr = year(date())
> monthstr = month(date())
> if monthstr < 10
>     monthstr = "0"+ monthstr
> endif
> daystr = day(date())
> if daystr < 10
>     daystr = "0" + daystr
> endif
> datestring = "'"+yearstr+"-"+monthstr+"-"+daystr+"'"
> msgbox( datestring )

It looks as if you're doing this the hard way but certainly it should
work.  As I've said before, twelve programmers a dozen solutions. :-)

I don't use MySQL but after reading something Akshat (who uses mariaDB
which is a fork of MySQL) posted I did what I should have done in the
first place. RTFM. :-)

MySQL will accept a literal date in the form 'yyyy-mm-dd', 'yyyymmdd' or
even as a number yyyymmdd.

dtos() outputs a date as yyyymmdd as a string

Try using

datestring = dtos(dDate)

If using this version of datestring in your SQL statement doesn't work
then try

datestring = "'"+dtod(dDate)+"'"