Is there an easy way to return the SQL format for a Date?

Barry G. Sumpter BarrySum at BigPond.Net.AU
Sat Jul 14 18:21:52 CDT 2007


Found this in the samples - not in the wiki
mDB.DateFormat = EVDateFormat.kYMD




-----Original Message-----
From: valentina-bounces at lists.macserve.net
[mailto:valentina-bounces at lists.macserve.net] On Behalf Of Barry G. Sumpter
Sent: Sunday, 15 July 2007 9:11 AM
To: 'Valentina Developers'
Subject: Is there an easy way to return the SQL format for a Date?

Hi all,

I'm looking for a way to return a date in yyyy-mm-dd format.
I think its called SQL format.

I'm using this:

SELECT 
concat(Year(T1.StartDate), '-', 
LPad(Month(T1.StartDate),2,'0'), '-', 
LPad(Day(T1.StartDate),2,'0'))
FROM T1

Which returns:  1900-09-01
Instead of: 1900-9-1


This gets quite complex if you have 4 or 5 date fields.

Is there an easier way?

Something like: 

SELECT 
format(T1.StartDate, 'yyyy-mm-dd') as myDate
FROM T1



All the best.

     Barry G. Sumpter


_______________________________________________
Valentina mailing list
Valentina at lists.macserve.net
http://lists.macserve.net/mailman/listinfo/valentina



More information about the Valentina mailing list