our Date format : 9/7/2013 3:04:14 PM
We want to get the problem solved, & want the global time i.e no AM/PM
desired output will be : 2013-09-07T15:04:14
DateTime time = Convert.ToDateTime("9/7/2013 3:04:14 PM");
string format="yyyy-MM-ddTHH:mm:ss" ;
string FormattedTime= time.ToString(format);
Output :
2013-09-07T15:04:14
you can use more date formats like,
Here:
We want to get the problem solved, & want the global time i.e no AM/PM
desired output will be : 2013-09-07T15:04:14
DateTime time = Convert.ToDateTime("9/7/2013 3:04:14 PM");
string format="yyyy-MM-ddTHH:mm:ss" ;
string FormattedTime= time.ToString(format);
Output :
2013-09-07T15:04:14
you can use more date formats like,
MMM ddd d HH:mm yyyy
M d h:mm yy
Here:
MMM display three-letter month
ddd display three-letter day of the WEEK
d display day of the MONTH
HH display two-digit hours on 24-hour scale
mm display two-digit minutes
yyyy display four-digit year
No comments:
Post a Comment