Link to home
Start Free TrialLog in
Avatar of ptslv
ptslvFlag for United States of America

asked on

Problem with Format Report Date

I am using C# in my web app.  I am trying to format the report date to read "ddHHmmMMMyy" but am getting an error "cannot implicitly convert type 'string ' to System.DateTime"

My code:

DateTime now = DateTime.Now.ToString("dd MMM yy HHMM");
            int year = now.Year;
            string month = now.Month.ToString();
            int day = now.Day;
            int hour = now.Hour;
            int minute = now.Minute;
                       
            lblRptDate.Text = day.ToString() + hour.ToString() + minute.ToString() + month + year.ToString();

ptslv
ASKER CERTIFIED SOLUTION
Avatar of effes
effes
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ptslv

ASKER

effes,

That worked perfect.  Thank you so much!

regards,
ptslv