?
Solved

Format a DateTime field

Posted on 2012-04-10
5
Medium Priority
?
325 Views
Last Modified: 2012-04-10
Hi Guys,

Can somebody help me to format a Datetime field "Eventdate"  in my SQL query to this format:

24 Jul 2012

This is the query:

"SELECT EventDate, EventDescription FROM Events"
0
Comment
Question by:dizzycat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 37828992
CONVERT(VARCHAR(11), eventdate, 106)
0
 
LVL 14

Accepted Solution

by:
nishant joshi earned 2000 total points
ID: 37829005
IF eventdate is datetime then

SELECT CONVERT(VARCHAR(11),EventDate,106) AS [DD MON YYYY]  EventDescription FROM Events
0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 37829007
SELECT convert(varchar(20),EventDate,106) as EventDate, EventDescription FROM Events

Other date/time formatting options here:
http://msdn.microsoft.com/en-us/library/ms187928%28v=sql.100%29.aspx
0
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37829016
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 37829168
wouldn't a split be in order?
0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question