Question:
Date Conversion from Month Date, Year to YYYYMMDD in SQL?
1970-01-01 00:00:00 UTC
Date Conversion from Month Date, Year to YYYYMMDD in SQL?
Four answers:
2016-12-16 13:33:46 UTC
On a severe notice, i do no longer see why it concerns. Yeah the age hollow between small young babies is larger mentally and emotionally then 3 years could be with young babies or adults, yet its unlike something can ensue different than ingesting playdoh and playing coach me yours (which could ensue with any buddy of the different intercourse). Your new child will in all probability no longer even know what relationship is and purely positioned the label on it that's kinda lovable. Plus her being around older young babies would desire to help her %. up on what the older new child is discovering at school and help her advance speedier mentally that's a extensive head start up for you and could make existence much less difficult whilst shes starts off college.
Mark G
2007-11-14 11:46:35 UTC
Ok. I got yahoo to accept it by separating some of the functions. When you paste it onto your system, just bring all the lines together to form one line. Be careful you don't delete any commas.



select substring(

convert(char(4),

datepart(yyyy,

convert(smalldatetime,'April 11, 2007'))),1,2) +

convert(char(6),

convert(smalldatetime,'April 11, 2007'),12)



To use a field name instead of a hardcode date, just replace with the field:



select substring(

convert(char(4),

datepart(yyyy,

convert(smalldatetime,

FieldName))),1,2) +

convert(char(6),

convert(smalldatetime,

FieldName),12)

From

TableName



Edit:



Rich is corrrect...



And assuming your date field is of type char you still need to covert it to smalldatetime, prior to using style 112.



select convert(char(10),convert(

smalldatetime,'April 11, 2007'),112)
Jonny
2007-11-14 10:59:11 UTC
what kind of datatype is the field. Is it a datetime or a varchar. I would just select them out and use datepart to rework it maybe.
2007-11-14 12:50:31 UTC
If you look up the convert function you will get it. No need to break it into parts like the previous post.



just this

convert(varchar, field_name, 112)



the varchar is the field type,

field_name is the name of your field

112 represents yyymmdd



http://msdn2.microsoft.com/en-us/library/aa226054(SQL.80).aspx


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...