Computing.Net > Forums > Database > date format in SQL Server

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

date format in SQL Server

Reply to Message Icon

Original Message
Name: bismarkcount
Date: July 12, 2007 at 07:36:50 Pacific
Subject: date format in SQL Server
OS: windows xp
CPU/Ram: 1gb
Model/Manufacturer: dell
Comment:

Hi!
i would like some help to figure this out:

How can i select a datetime field in sql server in an specific format?

ie: when i execute:
select (datefield) from table
the result is something like:
07/12/2007 09:34

is there a way to do something like this oracle sentence for SQL Server?:
select to_char(datefield, 'mm/dd/yyyy') from table

thnx a lot


Report Offensive Message For Removal


Response Number 1
Name: jqp
Date: July 19, 2007 at 18:16:47 Pacific
Reply: (edit)

Yes, you need to look up CAST and CONVERT in the SQL Server Books Online - it will probably have an example that you want.

ASUS M2NPV-VM <> Athlon X2 4200+ <> 2GB 800Mhz <> 1TBinternal storage 1TB DAS usb <> nVidia Geforce 6150 <> Samsung 22"


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: date format in SQL Server

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 





Do you own an iPhone?

Yes
No, but soon
No


View Results

Poll Finishes In 6 Days.
Discuss in The Lounge
Poll History




Data Recovery Software