[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Convert date format
- From: Marius Kjeldahl <marius@...>
- Date: Fri, 31 May 2002 22:46:12 +0200
I have no experience with this in lua, but as far as I know both Oracle and
Mysql has functions that you can use in select statements that return the
format in the format you want. From your example, it looks like lua just
returns the string from the database anyway, which means using database
functions for string formatting should work just fine.
I use LuaSQL to query a database.
In case that the field is in date format, it return a string '2002-10-10
I want to change the format for '10/10/02'.
I can use strfind and strsub.
The date() function could receive this string as parameter?
It would be the ideal.
a = date('%d/%m/%y ', ' 2002-10-10 00:00:00 ')
print(a) - > 10/10/02
What is the best way to make this conversion?
Or I can format LuaSQL to return the date in the desired format?