> update tableName set DOB=substr(DOB,7,4)||substr(DOB,3,4)||substr(DOB,1,2);
Am I missing some magic here? To me, this looks like it'll result in MMDD.
Does SQLite convert MMDD date strings?
I would've gone with the original -MM-DD date string that Igor posted.
Thanks!
-Clark
- Original Message
From: Gerry Snyder <[EMAIL PROTECTED]>
To: sqlite-users@sqlite.org
Sent: Friday, August 18, 2006 5:54:22 AM
Subject: Re: [sqlite] Re: Using Wrong Date Format
Igor Tandetnik wrote:
> Eoin Collins <[EMAIL PROTECTED]>
> wrote:
>> The database I'm currently using has a field Date Of Birth, and all
>> enteries in are in dd-mm- format.
>>
>> I need them in -mm-dd format.
>
> update tableName set
> DOB=substr(DOB,7,4)||'-'||substr(DOB,4,2)||'-'||substr(DOB,1,2);
>
One tiny simplification: |'-'||substr(DOB,4,2)||'-'| can be replaced
by |substr(DOB,3,4)| making the total command:
update tableName set DOB=substr(DOB,7,4)||substr(DOB,3,4)||substr(DOB,1,2);
Gerry
-
To unsubscribe, send email to [EMAIL PROTECTED]
-