ptslv
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That worked perfect. Thank you so much!
regards,
ptslv