Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time error #13

Open
wenddymacro opened this issue May 9, 2020 · 11 comments
Open

Time error #13

wenddymacro opened this issue May 9, 2020 · 11 comments

Comments

@wenddymacro
Copy link

wenddymacro commented May 9, 2020

Error using datetime (line 640)
Could not recognize the date/time format of '09-May-2020'. You can specify a format using the 'InputFormat' parameter. If the date/time text contains 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.
Error in getDataCOVID (line 47)
time = datetime(2020,01,22):days(1):datetime(datestr(floor(datenum(now))))-datenum(1);

@wenddymacro wenddymacro changed the title Time Time error May 9, 2020
@wenddymacro
Copy link
Author

Evironment: Matlab 2020a

@ECheynet
Copy link
Owner

Hi,
Thank for the feedback. I am sorry but I cannot reproduce the error. I guess it's ok to let the issue as "open" so other users who may encounter this problem see your post.

@wenddymacro
Copy link
Author

Hi, Cheynet,

This issue had been sovled. Maybe it due to matlab version. In getDataCOVID.m, I modified the code in line 48 to ''datetime(datestr(now,'yyyy-mm-dd'))-datenum(1)'', and in ChineseProvince.mlx, "datetime(datestr(now,'yyyy-mm-dd'))+datenum(10);" in line 89.

Then it's ok!

@csyuhao
Copy link

csyuhao commented Jun 24, 2020

I also encounter this problem and the version of my MATLAB is R2020a. I solve this problem by changing the code from

datetime(datestr(floor(datenum(now))))-datenum(1)

to

datetime(floor(datenum(now)), 'ConvertFrom','datenum')-datenum(1)

Ref: Examples

@ECheynet
Copy link
Owner

Hi yuhaoooo,

Thank you for the feedback. Both forms work on my Matlab version, but I have R2019b. There may have been some changes in R2020a? I will update the syntax to the one you propose. We can let the issue as "open" until I create a new release.

@csyuhao
Copy link

csyuhao commented Jun 25, 2020

I think this is because my machine set is Chinese. And I guess your machine set is English. So I should add Locale, en_US in the datetime function, just like this:

time = datetime(2020,01,22):days(1):datetime(datestr(floor(datenum(now))), 'Locale', 'en_US')-datenum(1);

And this does work in my machine.

@ECheynet
Copy link
Owner

OK thank, I did not know about that. I will do it.

@ECheynet
Copy link
Owner

I have uploaded a new version of the code with the suggestion by @YUHAOOOO

@wenddymacro
Copy link
Author

Hi,Cheynet

Thanks for your adjustments

In addition, how to aggregate all provinces of china to country data ?

@ECheynet
Copy link
Owner

Hi @wenddymacro ,

You may do as I did in the example "Example_US_cities.mlx" for the state of Washington. For China, it should be possible to iterate over each province and cumulate the time histories of confirmed, deceased and recovered cases.

@wenddymacro
Copy link
Author

Thanks, I had aggregated the chinese data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants