Matlab: Convert Unusual Date Format to Readable Date

  • MATLAB
  • Thread starter confused_engineer
  • Start date
  • Tags
    Format
In summary, to convert an unusual date format to a readable date in Matlab, you can use the datestr function with a format specifier. This function allows you to specify your own date format and can handle an unlimited number of different date formats. It also has the ability to convert to different languages by using a language specifier.
  • #1
confused_engineer
39
2
Hello everybody.
Recently I have been given a series of archives which contain a series of measurements and the dates in which they were measured. The problem is that this format is the time which has happened in hours since 1900-01-01 at midnight. Can someone tell me how can I find out how to find the proper date using Matlab.

The times are
1022676
1022682
1022688
1022694
1022700
1022706
1022712
1022718
1022724

Thanks for the help
 
Physics news on Phys.org
  • #2
You need to add those hours to the origin date, something like
Matlab:
time = double(hours)/24 + datenum('1900-01-01 00:00:00');
 

Related to Matlab: Convert Unusual Date Format to Readable Date

1. How do I convert an unusual date format to a readable date in Matlab?

To convert an unusual date format to a readable date in Matlab, you can use the datestr function. This function takes in a date string and a format specifier as inputs, and returns a readable date string in the specified format. For example, if your date string is in the format 'yyyy-mm-dd', you can use the following code to convert it to a readable date:

datestr('2021-05-15', 'mmm dd, yyyy')

This will return the date as 'May 15, 2021'.

2. What is an unusual date format in Matlab?

An unusual date format in Matlab refers to a date string that is not in a standard format such as 'mm/dd/yyyy' or 'dd-mmm-yyyy'. It could be a custom format that you have defined or a format used in a different country or region.

3. Can I specify my own date format when converting an unusual date format in Matlab?

Yes, you can specify your own date format when converting an unusual date format in Matlab using the datestr function. You can use format specifiers such as 'mm' for month, 'dd' for day, and 'yyyy' for year to create your own format.

4. Is there a limit to the number of different date formats that can be converted in Matlab?

No, there is no limit to the number of different date formats that can be converted in Matlab. As long as you know the format of the date string, you can use the datestr function to convert it to a readable date.

5. Can I convert unusual date formats to different languages in Matlab?

Yes, you can convert unusual date formats to different languages in Matlab by using the datestr function with a language specifier. For example, to convert the date string '2021-05-15' to French, you can use the following code:

datestr('2021-05-15', 'dd mmm yyyy', 'fr_FR')

This will return the date as '15 mai 2021'.

Similar threads

  • Biology and Chemistry Homework Help
Replies
6
Views
591
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Replies
5
Views
970
  • Special and General Relativity
2
Replies
37
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • Computing and Technology
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
16
Views
13K
Back
Top