Help on sql datetime format

Hello any one…

can anyone direct me how to create a dateformat in SQL…

mm-dd-yy hh:mm:ss: am or pm
example:
03-05-2011 03:56:25 pm

i don’t understand the question

all sql databases have built-in date formats

which database are you using? microsoft sql server?

what i mean is to convert the datetime format…

mm-dd-yy hh:mm:ss: am or pm
example:
03-05-2011 03:56:25 pm

CONVERT(CHAR(10),mydatetime,110) gives mm-dd-yyyy

CONVERT(CHAR(8),mydatetime,108) gives hh:mm:ss (24-hour)

other styles are available which include the AM/PM variation

you may have to mix & match and use additional SUBSTRING and concatenation functions to get the exact format you want

check the documentation for the CONVERT function