Hi,
I retrieved a date and time string from a website, and it is in the following format:
"Fri, 22 Mar 2013 4:01 pm CST"
I tried to use DateTime.DateParse to turn it into DateTime format, but it can not recogonize the format, and returns error "Unparseable date".
I tried with a part of that string "22 Mar 2013", I get the same error.
What is the best way to change the date-time string into DateTime format?
[EDIT] I get it. I didn't know that I need to first set the DateTime.DateFormat.
Now I set it to "EEE, dd MMM yyyy h:mm a".
With this format, it can parse "Fri, 22 Mar 2013 4:01 pm" without problem, but only when the phone's language is set to English.
When the language is set to Chinese, it can't parse "Fri, 22 Mar 2013 4:01 pm", with the format of "EEE, dd MMM yyyy h:mm a".
With Log(DateTime.Date (DateTime.Now)), I see that the day of week, the month and the am/pm are all in Chinese.
So, how can I parse English date-time string in a Chinese language phone?
Thanks!
[SOLVED]
I am using AHLocale library to do it:
http://www.b4x.com/forum/additional-libraries-classes-official-updates/7561-ahlocale-library.html
I don't know how to edit the title, or delete the whole post, since it is not needed now.
I retrieved a date and time string from a website, and it is in the following format:
"Fri, 22 Mar 2013 4:01 pm CST"
I tried to use DateTime.DateParse to turn it into DateTime format, but it can not recogonize the format, and returns error "Unparseable date".
I tried with a part of that string "22 Mar 2013", I get the same error.
What is the best way to change the date-time string into DateTime format?
[EDIT] I get it. I didn't know that I need to first set the DateTime.DateFormat.
Now I set it to "EEE, dd MMM yyyy h:mm a".
With this format, it can parse "Fri, 22 Mar 2013 4:01 pm" without problem, but only when the phone's language is set to English.
When the language is set to Chinese, it can't parse "Fri, 22 Mar 2013 4:01 pm", with the format of "EEE, dd MMM yyyy h:mm a".
With Log(DateTime.Date (DateTime.Now)), I see that the day of week, the month and the am/pm are all in Chinese.
So, how can I parse English date-time string in a Chinese language phone?
Thanks!
[SOLVED]
I am using AHLocale library to do it:
http://www.b4x.com/forum/additional-libraries-classes-official-updates/7561-ahlocale-library.html
I don't know how to edit the title, or delete the whole post, since it is not needed now.
Last edited: