SQL Date Formatting
Pete
pete at mollysrevenge.com
Wed Jan 11 21:53:32 EST 2012
Hi Bob,
I guess it depends on what you mean by "real dates" SQL date fields are
pretty specific as to their format, that's why you give them a type of DATE
or DATETIME. It's just a case of adjusting your SELECT statement to use
the functions that SQL provides to return the date in whatever format you
want.
In SQLite, SELECT strftime(DateField,'%m/%d/%Y') returns the date in US
format.
In mySQL, SELECT DATE_FORMAT(DateField,'%m/%d/%Y)
Or you can select the field as is and convert it in LC:
set the itemdelimiter to "/"
put item 2 of myDate & "/" & item 3 of myDate & "/" & item 1 of myDate
Pete
On Wed, Jan 11, 2012 at 5:20 PM, Bob Sneidar <bobs at twft.com> wrote:
> Hi all. I am having F-I-TZ working with dates in mySQL. I WANT to store
> the dates as real dates, but mySQL formats them as yyyy-mm-dd. Livecode
> does no such thing and nothing I know how to do can get Livecode to work
> with dates in this format AS dates.
>
> It's no good for my present purposes to work with other formats. I query
> SQL and then drop the data into a datagrid with no custom formatting, and
> that is just the way it has to be. What I need is to tell Livecode to sue
> SLQ date formatting. I have no real hope, but if someone knows of a way to
> do that, I would appreciate it.
>
> I think what is really needed is a feature request for one more date
> format for the convert command: convert myDate to sqlDate. <sigh>
>
> Bob
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
--
Pete
Molly's Revenge <http://www.mollysrevenge.com>
More information about the use-livecode
mailing list