SELECT CAST(DATEPART(dd, fieldname) AS varchar(2)) + '/' + CAST(DATEPART(mm, fieldname) AS varchar(2)) + '/' + CAST(DATEPART(yyyy, fieldname) AS varchar(4)) + ' ' + CAST(DATEPART(hh, fieldname) AS varchar(2)) + ':' + CAST(DATEPART(mi, fieldname) AS varchar(2)) AS new_datetime FROM tablename
ส่วนนี่ ได้ day/month/year Code
SELECT CAST(DATEPART(dd, fieldname) AS varchar(2)) + '/' + CAST(DATEPART(mm, fieldname) AS varchar(2)) + '/' + CAST(DATEPART(yyyy, fieldname) AS varchar(4)) AS new_datetime FROM tablename
อยากได้อะไรขึ้นก่อนก็สลับเอา
Date :
2009-09-04 19:54:13
By :
plakrim
No. 7
Guest
$strSQL="select convert(char,BIRTHDAY,101) FROM UOC_STAFF where CITIZEN_ID='$CITIZENID'; ";
$objQuery = mssql_query($strSQL);
while ($row=mssql_fetch_array($objQuery)){
echo $bmonth=$row['BIRTHDAY'];}
ค่าไม่ออกอะ
$strSQL="select convert(char,BIRTHDAY,101) FROM UOC_STAFF where CITIZEN_ID='$CITIZENID'; ";
$objQuery = mssql_query($strSQL);
while ($row=mssql_fetch_array($objQuery)){
echo $bmonth=$row['BIRTHDAY'];}
Code
$strSQL="select convert(char,BIRTHDAY,101) as BIRTHDAY FROM UOC_STAFF where CITIZEN_ID='$CITIZENID'; ";
$objQuery = mssql_query($strSQL);
while ($row=mssql_fetch_array($objQuery)){
echo $bmonth=$row['BIRTHDAY'];}