January 15, 2017 at 6:42 am
This is a part of a procedure that I have trouble with :
declare
@UpdateDate VARCHAR(21) ,
-- date and user
SELECT
@UserName = SYSTEM_USER ,
@UpdateDate = CONVERT(VARCHAR(8), GETDATE(), 112)
+ ' ' + CONVERT(VARCHAR(12), GETDATE(), 114)
First one it seems gives me : jan 15 2017 2:32PM
Second: 20170115 14:32:46:627
I would like both the dates to be like : 15.01.2017 14:00
I have tried all afternoon to get it right from various examples but cant make it
right.
January 15, 2017 at 8:13 am
Senchi - Sunday, January 15, 2017 6:42 AMThis is a part of a procedure that I have trouble with :declare
@UpdateDate VARCHAR(21) ,-- date and user
SELECT
@UserName = SYSTEM_USER ,
@UpdateDate = CONVERT(VARCHAR(8), GETDATE(), 112)
+ ' ' + CONVERT(VARCHAR(12), GETDATE(), 114)First one it seems gives me : jan 15 2017 2:32PM
Second: 20170115 14:32:46:627I would like both the dates to be like : 15.01.2017 14:00
I have tried all afternoon to get it right from various examples but cant make it
right.
DECLARE @UpdateDate VARCHAR(20)
SELECT
@UpdateDate = CONVERT(VARCHAR(10), GETDATE(), 104) + ' ' + CONVERT(VARCHAR(5), GETDATE(), 114)
PRINT @UpdateDate
Output
/*
15.01.2017 16:11
*/
Igor Micev,My blog: www.igormicev.com
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy