How to parse date/time text using different locale?

Hello every one,
I am using Matlab 2018b. I have one table as given below.
Date Start Stop
____________ ________ ________
'12July2004' 09:02:52 09:52:01
'13July2004' 08:00:04 08:57:23
'13July2004' 09:26:53 09:28:18
'14July2004' 09:34:04 09:35:18
'09July2005' 08:04:08 08:05:54
'09July2005' 09:41:52 09:43:06
'12July2007' 09:15:00 09:27:01
'16July2007' 07:30:58 07:31:56
'06July2008' 14:42:42 14:46:58
'07June2010' 11:27:12 11:33:24
'05July2011' 11:04:50 11:07:28
'11July2011' 09:15:40 09:19:26
'21July2011' 07:35:02 07:54:00
'02July2012' 10:12:14 10:21:07
'21June2013' 09:15:26 09:16:43
'22June2013' 09:57:07 09:58:57
'22June2013' 10:41:16 10:59:55
'22June2013' 11:21:02 11:57:55
'22June2013' 12:09:31 12:55:45
'23June2013' 10:06:00 10:20:00
'23June2013' 12:32:24 12:48:48
'26July2013' 11:40:28 11:53:45
'17July2015' 05:48:04 05:59:12
'17July2015' 06:00:14 06:29:55
'17July2015' 07:17:21 07:50:00
I want to get only date without year from the above table. I have used the command below,
dates=datetime((timedata.Date),'InputFormat','ddMMMMyyyy','Format','ddMMMM');
But i received an error message
Error using datetime (line 616)
Unable to parse date/time text using the format 'ddMMMMyyyy'. If the date/time text contain day, month, or time zone names in a language foreign to
the 'zh_CN' locale, those might not be recognized. You can specify a different locale using the 'Locale' parameter.
Any help will be greatly appreciated.
Thanks

回答(1 个)

Does the suggestion in the error message not solve this problem? It appears that you are trying to read timestamps with english month names on a machine set to chinese. Try adding 'Locale','en_US'.
Your post's title says "time zone", I don't think this has anything to do with time zones. It about language, i.e. locale.

2 个评论

The problem is solved by changing the format and system locale from chinese to english (US).
Thanks
Hello, how do you changed it? because my laptop it's in spanish but matlab doesnt detect it, and it says me that oct is not valid.

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 C Shared Library Integration 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by