Hello my problem is to convert "Friday, 16 March 2012 12:45:11 +05:30"
to "2012-03-16 12:45:11 z+05:30" i have tried to solve it by following code and i'm getting a bug only YEAR and MONTH are displayed and the rest all are zero's
i tried and unable to resolve the bug can anyone findout the bug i have made correct it thanks in advance.I used visual studio 2010 to build the code.
If you're going to iterate the string, one character at a time, you'll need to keep track of the state. That is, you'll need to keep track of what you're processing; the day, date, time, ...
An alternative way to parse things is to extract tokens. No state, you just pick up what you're looking for and can optionally validate it yourself.
In this case, the seperators are ", " and the input format is:
<day of week text><month day><month text><year><time><time zone>
and your output is
<year>-<month>-<month day> <time> z<time zone>