Geeks With Blogs
Gaurav Taneja Great dreams... never even get out of the box. It takes an uncommon amount of guts to put your dreams on the line, to hold them up and say, "How good or how bad am I?" That's where courage comes in.
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) Posted on Monday, March 24, 2008 11:04 PM | Back to top

Comments on this post: Converting Datetime to dd/mm/yyyy hh:mm AM/PM format

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Gaurav Taneja | Powered by: