9.1.4 Import Time Data
Origin interprets Dates based upon the Gregorian Calendar, while Time is interpreted in hours:minutes:seconds. When working with Date and Time data, Origin displays these data in different formats, but internally uses underlying numeric values for calculations and certainly plotting operations. This tutorial shows you how to import custom date/time data.
Minimum Origin Version Required: Origin 8.0 SR3
What you will learn
This tutorial covers:
- How to import data using multiple delimiters.
- How to define a custom date/time format
- How to change the display settings for the custom date/time format
- How to save import settings in a filter for reuse
- We will import \Samples\Import and Export\Custom Date and Time.dat in this tutorial. Before importing the file, let's look at the data structure first.
We can see that there is a space between Date and Time, and it uses Tab to separate Time from the rest of the data. So we will use multiple delimiters to import this data file.
- Open the file in Import Wizard. Accept the default settings on all pages until you get to the Data Columns page. Origin will, by default, use Tab to separate the data into two columns. To divide Date and Time, check the Tab/Space checkbox in the Column Separator group.
Note in the preview box that the column title is A(Y)(T&N), where (T&N) means the data format is Text & Numeric. Because the date uses "." to separate day, month and year, Origin by default treats the first column as Text. For the second Time column, Origin shows the underlying numeric values. To import data correctly, we should change the column properties.
- In the Custom Date Format edit box, enter:
where dd, MM and yyyy mean the days, months, and year respectively. Since the "."is used as a separator, we need to put single quotation marks around it in the format specification. After entering the custom format, press the Apply button next to the edit box. Then right-click on the header of the first column in the preview and select Date from the context menu:
Then the column title will turn into A(Y)(D) which means this is now a Date data column.
- Similarly, right-click on the header of the second column and select Time to set that column as a time column:
You can see the time data display in long format. We can change the display setting after imported.
- Click Next twice to go to the Save Filters page. Select Save filter checkbox and In the User File folder radio box to save the import settings to a filter. Enter the filter file name as Custom Date and Time in the Filter file name (.OIF extension will be appended) edit box.
- Click Finish button to import data. Then double-click the second column title to open the Column Properties dialog, and set the Time display as:
The final worksheet data after imported will looks like:
- Open Windows Explorer and browse to folder \Samples\Import and Export\. Locate the file Custom Date and Time.dat, drag and drop it to Origin workspace. The Select Filter dialog will open asking you to select a filter.
Select Custom Date and Time filter just saved. It will be used to import the file.
Note: In the case of this particular data file, the first column simply has the exact same date in every row. So at this point you may want to set this first column as Disregard by right-clicking on the column header and selecting Disregard from the context menu. Then you can set the 2nd column as type X, and plot the data in the third column against the time data in the 2nd column.