x
login about faq Site discussion (meta-askssc)

Need to get date and time in format of 20120817133600

Hello, I need to get date and time in format of 20120817133600. Tried use Convert Replace, but without success, Please help. Thank you in advance.

more ▼

asked Aug 18 '12 at 05:42 PM in Default

innap9999 gravatar image

innap9999
0 1

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

Try

select REPLACE(REPLACE(REPLACE(replace (convert(varchar(30), GETDATE(),121), '-', ''), ' ', ''), ':', ''), '.', '')

more ▼

answered Aug 18 '12 at 06:38 PM

SirSQL gravatar image

SirSQL
4.8k 1 3

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x84

asked: Aug 18 '12 at 05:42 PM

Seen: 221 times

Last Updated: Aug 18 '12 at 06:39 PM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.