Use the ToString overload and pass the format required in it.
Eg:
dt.ToString("mm ddyyyy"); or
dt.ToString("dd-mm-yy");
--
Rakesh Rajan
"Jack" wrote:
[color=blue]
> I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy. What
> is the easiest way to do this?
>
>
>[/color]
That is what I was attempting but found a nuance... mmddyyyy formats as
minute, day, month. The correct format is MMddyyyy.
"Rakesh Rajan" <RakeshRajan@di scussions.micro soft.com> wrote in message
news:89EA38AD-B72B-4364-9EF7-2F5943616EB9@mi crosoft.com...[color=blue]
> Use the ToString overload and pass the format required in it.
>
> Eg:
> dt.ToString("mm ddyyyy"); or
> dt.ToString("dd-mm-yy");
> --
> Rakesh Rajan
>
>
> "Jack" wrote:
>[color=green]
> > I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy.[/color][/color]
What[color=blue][color=green]
> > is the easiest way to do this?
> >
> >
> >[/color][/color]
Jack wrote:[color=blue]
> I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy. What
> is the easiest way to do this?
>
>[/color]
DateTime dt = DateTime.Now;
anon <a@a.com> wrote:[color=blue]
> Jack wrote:[color=green]
>> I am trying to format a DateTime object as mmddyyyy and NOT mm/dd/yyyy. What
>> is the easiest way to do this?
>>
>>[/color]
> DateTime dt = DateTime.Now;
>
> System.Console. WriteLine(strin g.Format("{0,2: 00}{1,2:00}{2,0 4:0000}",dt.Day ,dt.Month,dt.Ye ar));[/color]
Comment