sql server - SQL Select Specific Date format dd/mm/YYYY hh:mm:ss -


i want select record table date format stored 'jan 27 2015 12:00am' when select should covert date following format '27/01/2015 00:00:00'.

i tried following works date not time. used date.

select  convert(varchar(10), convert(date,startdate,106), 103) + ' '  + convert(varchar(8), getdate(), 14) startdate logistic 

can 1 me convert date format correctly.

i tried answer:

convert(varchar(10), startdate, 103)                          + ' ' + convert(varchar(8), startdate, 108) 

result: aug 25 201 aug 25 2

convert mmm dd yyyy hh:mm[am|pm] dd/mm/yyyy hh:mm:ss

declare @date varchar(20) = 'jan 27 2015 12:05am'  select convert(varchar(10), convert(datetime, @date),103)           + ' ' + convert(varchar(8), convert(datetime, @date),108)       result:    27/01/2015 00:05:00 

Comments

Popular posts from this blog

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -