andy.gear
SSC-Addicted
Points: 493
More actions
January 23, 2009 at 9:20 am
#127584
I want to get today's date as YYYY-M-D so today would actually be
2009-1-23 and Feb 1st would be 2009-2-1.
I can't find a mask I want in CONVERT.
Jack Corbett
SSC Guru
Points: 184394
January 23, 2009 at 9:41 am
#931902
I think you are going to need to do custom code for this. This will work:
SELECT
CONVERT(CHAR(4), YEAR(GETDATE())) + '-' +
CONVERT(VARCHAR(2), MONTH(GETDATE())) + '-' +
CONVERT(VARCHAR(2),DAY(GETDATE()))
Jack CorbettConsultant - Straight Path SolutionsCheck out these links on how to get faster and more accurate answers:Forum Etiquette: How to post data/code on a forum to get the best help Need an Answer? Actually, No ... You Need a Question
January 23, 2009 at 9:52 am
#931915
Okay, so long as I wasn't missing an easier way to do it. Thanks!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply