Hi all,
I am trying to format some dates using datapart, my date format looks like
2005-06-13 00:00:00.000, I want the year and the month together to look like
200506, but the datepart's and conversts I have tried keep giving me 20056,
is there a way to add the '0' where it is needed.
Thanks in advance, PhilYou could use
select convert(char(6),getdate(),112)
and just replace getdate() with your date.
--
Adam J Warne, MCDBA
"Phil" wrote:
> Hi all,
> I am trying to format some dates using datapart, my date format looks like
> 2005-06-13 00:00:00.000, I want the year and the month together to look li
ke
> 200506, but the datepart's and conversts I have tried keep giving me 20056
,
> is there a way to add the '0' where it is needed.
> Thanks in advance, Phil|||Thanks for that, I think I was trying to make things more difficult than the
y
needed to be, been one of those days.
Thanks Phil
"Adam Warne" wrote:
> You could use
> select convert(char(6),getdate(),112)
> and just replace getdate() with your date.
> --
> Adam J Warne, MCDBA
>
> "Phil" wrote:
>
No comments:
Post a Comment