From: Larissa on
The problem is as following.
1. I have English (UK) country settings (MM-DD-YYYY) on my PC, but I am actually located in The Netherlands.
2. I receive a .csv file from our IT where the date/time variables are in DD-MM-YYYY hh:mm:ss format.
3. I need to import this file to an Access table and after some manipulations I export a few variables in Matlab (also date/time variables).
4. In Matlab, I also use function months to calculate the number of months passed from one date to another. Till now I assumed it always happened in a correct manner.
As you understand, there will be a difference in result if Matlab thinks that you have you date in MM-DD-YYYY format, and you deliver it in DD-MM-YYYY.
5. After calculations are finished, I export them to a .csv and load this csv to Access to join with the rest of the table.
6. Then I export the table to a .txt file to be used for calculations in another program. So all the steps before were just data preparations. That program requires point as decimal delimiter and DD-MM-YYYY as data/time notation.

Till now, everything was OK until someone from IT decided that I should use an import specification at step 3 and fixed date/time in Access at MM-DD-YYYY format (what is quite logical seeing my country settings). After that, everything went wrong. I am now doubting in my Matlab program and do not know how to fix the settings. Could anyone tell me how does it work? Which settings should I use in Matlab and which in Access? I do not have Database Toolbox, unfortunately.
Thank you for reading. :))
From: Steven Lord on

"Larissa " <lkotova(a)hotmail.com> wrote in message
news:ht5o1s$qht$1(a)fred.mathworks.com...
> The problem is as following.
> 1. I have English (UK) country settings (MM-DD-YYYY) on my PC, but I am
> actually located in The Netherlands.
> 2. I receive a .csv file from our IT where the date/time variables are in
> DD-MM-YYYY hh:mm:ss format.
> 3. I need to import this file to an Access table and after some
> manipulations I export a few variables in Matlab (also date/time
> variables).
> 4. In Matlab, I also use function months to calculate the number of months
> passed from one date to another. Till now I assumed it always happened in
> a correct manner.
> As you understand, there will be a difference in result if Matlab thinks
> that you have you date in MM-DD-YYYY format, and you deliver it in
> DD-MM-YYYY. 5. After calculations are finished, I export them to a .csv
> and load this csv to Access to join with the rest of the table.
> 6. Then I export the table to a .txt file to be used for calculations in
> another program. So all the steps before were just data preparations. That
> program requires point as decimal delimiter and DD-MM-YYYY as data/time
> notation.
>
> Till now, everything was OK until someone from IT decided that I should
> use an import specification at step 3 and fixed date/time in Access at
> MM-DD-YYYY format (what is quite logical seeing my country settings).
> After that, everything went wrong. I am now doubting in my Matlab program
> and do not know how to fix the settings. Could anyone tell me how does it
> work? Which settings should I use in Matlab and which in Access? I do not
> have Database Toolbox, unfortunately. Thank you for reading. :))

I don't use Access so I can't be certain, but I don't think there's anything
that MATLAB can do to help you, unfortunately. If your .csv file contained
the date January 13, 2010 (13-01-2010 in DD-MM-YYYY format) then wouldn't
Access either error or treat that as the first day in the 13th month in 2010
and interpret it as January 1st, 2011 (01-01-2011 in either format)? If
Access interprets it as the 13th month I'm not certain that there's anything
MATLAB can do, barring some other information (like the fact that the dates
are monotonic or contain data collected at certain specific intervals) to
determine if the January 1st, 2011 that it received from Access came from
01-01-2011 or from a misinterpreted 13-01-2010.

I think you need to negotiate with your IT staff to get the .csv and Access
formats to agree.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: Larissa on
Hi Steve, thanks for your reply.
I will surely negotiate with our IT about it, but I need to know which settings Matlab is using by default? Its internal settings, those from my PC, or those from Access? I read in the documentation that by default, it uses MM-DD-YYYY settings, can you confirm that? I just use function months as in months(date1, date2).