solraccheffy
asked on
format string to remove day of week
I am using VS.NET 2003 and need to display date but dont want the day of the week...so my string is currently....
Wednesday, April. 23, 2008
I created a case statement to check and truncate the month from April to Apr.
now i want to remove the day of the week, can I do this easier than doing a case statement and a replace, for each day of the week, looking for something with less code, perhaps an array type of idea...but not sure on how to go about that.
Wednesday, Apr. 23, 2008
Wednesday, April. 23, 2008
I created a case statement to check and truncate the month from April to Apr.
now i want to remove the day of the week, can I do this easier than doing a case statement and a replace, for each day of the week, looking for something with less code, perhaps an array type of idea...but not sure on how to go about that.
Wednesday, Apr. 23, 2008
ASKER
getting this error...
Argument '1': cannot convert from 'string' to 'long'
The best overloaded method match for 'System.DateTime.DateTime( long)' has some invalid arguments
The string I am passing is "Wednesday, April 23, 2008" does not work in your example.
DateTime newDate = new DateTime(FormattedDate);
return newDate.ToString("MMM dd, yyyy");
Argument '1': cannot convert from 'string' to 'long'
The best overloaded method match for 'System.DateTime.DateTime(
The string I am passing is "Wednesday, April 23, 2008" does not work in your example.
DateTime newDate = new DateTime(FormattedDate);
return newDate.ToString("MMM dd, yyyy");
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Snippet to ponder
String date = "Wednesday, Apr. 23, 2008";
String parts = date.Split (",");
date = parts[1]+","+parts[2];
Open in new window