Hi,
I get a datetime from system like this one : '2003-05-08 12:35:29.998'
And I just need '200305'.
Can I use Substring or any other way?
Thanks for any advice!
Angideclare @.dt datetime
set @.dt = getdate()
SELECT cast(datepart(yyyy, @.dt) as varchar(4)) + cast(datepart(mm, @.dt) as
varchar(2))
William Stacey [MVP]
"Angi" <enchiw@.msn.com> wrote in message
news:OD8fPOeBGHA.1312@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I get a datetime from system like this one : '2003-05-08 12:35:29.998'
> And I just need '200305'.
> Can I use Substring or any other way?
> Thanks for any advice!
> Angi
>|||declare @.dt datetime
set @.dt = getdate()
SELECT convert(char(6),@.dt,112)
"Angi" <enchiw@.msn.com> wrote in message
news:OD8fPOeBGHA.1312@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I get a datetime from system like this one : '2003-05-08 12:35:29.998'
> And I just need '200305'.
> Can I use Substring or any other way?
> Thanks for any advice!
> Angi
>|||Thanks for William and Uri!
Angi
"Angi" <enchiw@.msn.com> ¼¶¼g©ó¶l¥ó·s»D:OD8fPOeBGHA.1312@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I get a datetime from system like this one : '2003-05-08 12:35:29.998'
> And I just need '200305'.
> Can I use Substring or any other way?
> Thanks for any advice!
> Angi
>
No comments:
Post a Comment