Answered by:
Get current date

Question
-
Strange thing here, in a view i want to add a column with the current date, format needs to be europ.
select CONVERT(date ,getdate(),103) as datum
Result:
2015-01-22
I would expect it as:
22-01-2015
What's going wrong here?
Thursday, January 22, 2015 8:33 AM
Answers
-
Please try
select
CONVERT(varchar(10) ,getdate(),103) as datumNote: datetime is not having any format, only when converting to string, it gives format
- Edited by Mohd Moinuddin Thursday, January 22, 2015 8:42 AM comment
- Proposed as answer by Satheesh Variath Thursday, January 22, 2015 8:55 AM
- Marked as answer by MVP_88 Thursday, January 22, 2015 9:40 AM
Thursday, January 22, 2015 8:41 AM
All replies
-
Please try
select
CONVERT(varchar(10) ,getdate(),103) as datumNote: datetime is not having any format, only when converting to string, it gives format
- Edited by Mohd Moinuddin Thursday, January 22, 2015 8:42 AM comment
- Proposed as answer by Satheesh Variath Thursday, January 22, 2015 8:55 AM
- Marked as answer by MVP_88 Thursday, January 22, 2015 9:40 AM
Thursday, January 22, 2015 8:41 AM -
Refer: CAST and CONVERT (Transact-SQL)
SELECT CONVERT(varchar(10) ,getdate(),105) as datum
-Vaibhav Chaudhari
- Proposed as answer by Satheesh Variath Thursday, January 22, 2015 8:55 AM
Thursday, January 22, 2015 8:43 AM -
- Proposed as answer by Satheesh Variath Thursday, January 22, 2015 8:55 AM
Thursday, January 22, 2015 8:47 AM