Displays date time in 26/03/2008 09:30AM
CONVERT(VARCHAR,PostedDate,103)+' '+SUBSTRING(CONVERT(VARCHAR,getdate(),108),LEN(CONVERT(VARCHAR,getdate(),108))-7,5)+' ' +SUBSTRING(CONVERT( VARCHAR,getdate(),100),LEN(getdate())-1,2)
change the getdate() according to your field name
Below one displays the date as 26/03/2008 09:30 AM
CONVERT(VARCHAR,getdate(),103)+' '+ left(right('0'+LTRIM(RIGHT(CONVERT(varchar,getdate(),100),8)),7),5)+ ' ' + right(RIGHT('0'+LTRIM(RIGHT(CONVERT(varchar,getdate(),100),8)),7),2)
No comments:
Post a Comment