greese
IS-IT--Management
- Nov 6, 2003
- 13
I am exporting the date along with results from my table my table but need it in the format yymmdd 12/17/2003 becomes 031203.
To test this out, i have the following:
My results are:
how do i get the leading zero to drop in there for the date? When i concatenate it together i get 0418 instead of 040108
I have tried searching for something on this but came up empty.
Any ideas are greatly appreciated.
G Reese
To test this out, i have the following:
Code:
Declare @dtYear varchar(2)
Declare @dtMonth varchar (2)
Declare @dtDay varchar (2)
set @dtYear = right (Datepart(yyyy, Getdate()+22),2)
set @dtmonth = Datepart (mm, Getdate()+22)
set @dtDay = datepart (dd, Getdate()+22)
Select @dtYear as [Year],
@dtMonth as [Month],
@dtDay as [Day];
Code:
Year Month Day
---- ----- ----
04 1 8
I have tried searching for something on this but came up empty.
Any ideas are greatly appreciated.
G Reese