• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

Format a DateTime field

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
dizzycat
Asked:
dizzycat
1 Solution
 
sdstuberCommented:
CONVERT(VARCHAR(11), eventdate, 106)
0
 
nishant joshiTechnology Development ConsultantCommented:
IF eventdate is datetime then

SELECT CONVERT(VARCHAR(11),EventDate,106) AS [DD MON YYYY]  EventDescription FROM Events
0
 
wdosanjosCommented:
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
 
AnuroopsunddCommented:
0
 
sdstuberCommented:
wouldn't a split be in order?
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now