How can I insert MATLAB dates into Microsoft Access using the Database Toolbox?
8 ビュー (過去 30 日間)
古いコメントを表示
How can I insert MATLAB dates into Microsoft Access using the Database Toolbox?
When I try to send a MATLAB serial date, they are imported a couple of thousand years in the future.
採用された回答
MathWorks Support Team
2009 年 6 月 27 日
You are receiving different dates because MATLAB and Microsoft Access store dates internally in a different format. Both products use the idea of a serial date, where each date is represented by an integer. However, Access stores dates numerically relative to 01-Jan-1900, while MATLAB represents dates numerically relative to 01-Jan-0000.
To work around this difference in dates, you need to post-process your data in MATLAB after receiving it and pre-process the data before sending it back to Access.
To convert the Access serial dates to MATLAB serial dates, simply add 693960 to them. This is the difference in days between the 0 date in MATLAB and in Access.
Putting the dates back into Access can be done similarly; simply subtract 693960 from each date in MATLAB.
You can also apply the DATESTR function to each date to produce a date in a string format which Access recognizes. The default DATESTR format (DD-MMM-YYYY) translates directly into Access.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!