Mailing List Archive



Back to the month index Back to the list index

David Palmer (davidp@wsa.net.au)
Thu, 8 Apr 1999 18:32:09 +1000


From: "David Palmer" <davidp@wsa.net.au>
Subject: Converting a 6 digit date to mSQL Date format
Date: Thu, 8 Apr 1999 18:32:09 +1000
Message-ID: <008e01be819a$4c0e39e0$9a00a8c0@dave.WSA>

Hello,

Does anybody know a way to convert a 6 digit Australian date (ddmmyy) eg.
010499 into an mSQL date format. eg. 01-Apr-1999 using the Lite scripting
language ?

I tried the below code but it didn't work.
$row[1] is the variable holding the value 010499

$day = strseg($row[1],0,1);
$yr = strseg($row[1],4,5);

$mth = sub(strseg($row[1],2,3),"01","-Jan-");
$mth = sub(strseg($row[1],2,3),"02","-Feb-");
$mth = sub(strseg($row[1],2,3),"03","-Mar-");
$mth = sub(strseg($row[1],2,3),"04","-Apr-");
$mth = sub(strseg($row[1],2,3),"05","-May-");
$mth = sub(strseg($row[1],2,3),"06","-Jun-");
$mth = sub(strseg($row[1],2,3),"07","-Jul-");
$mth = sub(strseg($row[1],2,3),"08","-Aug-");
$mth = sub(strseg($row[1],2,3),"09","-Sep-");
$mth = sub(strseg($row[1],2,3),"10","-Oct-");
$mth = sub(strseg($row[1],2,3),"11","-Nov-");
$mth = sub(strseg($row[1],2,3),"12","-Dec-");

$msqldate = $day + $mth + $yr;

The variable echo's the value 04 instead of -Apr-

Any ideas on this ?