Matlab: Convert Unusual Date Format to Readable Date

  • Context: MATLAB 
  • Thread starter Thread starter confused_engineer
  • Start date Start date
  • Tags Tags
    Format
Click For Summary
SUMMARY

The discussion focuses on converting an unusual date format in MATLAB, where dates are represented as hours since January 1, 1900. Users provided a solution involving the MATLAB function datenum to convert these hour values into readable dates. The specific code snippet shared is time = double(hours)/24 + datenum('1900-01-01 00:00:00');, which effectively calculates the proper date by adding the hours to the origin date. This method is straightforward and leverages MATLAB's built-in date functions for accurate conversion.

PREREQUISITES
  • Familiarity with MATLAB programming language
  • Understanding of date and time functions in MATLAB
  • Basic knowledge of numerical data types in MATLAB
  • Concept of date representation in programming
NEXT STEPS
  • Explore MATLAB's datenum function for date conversions
  • Learn about MATLAB's datetime object for modern date handling
  • Research methods for handling time zones in MATLAB
  • Investigate MATLAB's datestr function for formatting dates
USEFUL FOR

This discussion is beneficial for MATLAB users, data analysts, and researchers who need to convert unconventional date formats into standard readable dates for analysis or reporting purposes.

confused_engineer
Messages
34
Reaction score
1
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
You need to add those hours to the origin date, something like
Matlab:
time = double(hours)/24 + datenum('1900-01-01 00:00:00');
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 16 ·
Replies
16
Views
15K
Replies
2
Views
3K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 7 ·
Replies
7
Views
25K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 11 ·
Replies
11
Views
4K