Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Format a DateTime field

Posted on 2012-04-10
5
Medium Priority
?
326 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this article, we’ll look at how to deploy ProxySQL.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

618 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