Format a DateTime field

Posted on 2012-04-10
Medium Priority
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"
Question by:dizzycat
LVL 74

Expert Comment

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

Accepted Solution

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
LVL 23

Expert Comment

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

Other date/time formatting options here:
LVL 17

Expert Comment

ID: 37829016
LVL 74

Expert Comment

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

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
An introductory discussion about Oracle Analytic Functions which are used to calculate or compute Aggregate values, based on a group of rows.
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

600 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