How to combine date and time columns?

I imported dataset with the separate date and time columns in text format. How can I create a new timestamp with them?

Hi,

It will depend a little bit on the exact format of the strings.  First thing to appreciate is date/time is just the number of secs since midnight of 1/1/1904.  So we have to covert your date and time fields to seconds.

The date part can be handled with the date2secs(year, month, day ) so you may need to parse out your string accordingly.

For the time part this is Hours*60*60 + min*60 +secs

With the total added together.

The alternative is to double check your import settings and set the appropriate fields to Date/time and let IP do the conversion.

Andy

Quote:
I imported dataset with the separate date and time columns in text format. How can I create a new timestamp with them?

You probably can import them directly as date and time columns but it depends on the exact format of the file.

For background information, execute:

DisplayHelpTopic "Date/Time Waves"
DisplayHelpTopic "Loading Delimited Text Files"

To say more I would need a sample file.

 

In reply to by hrodstein

Thank you. I imported them as text because they won't show correctly at the time part with added 01/01/1904 (UTC?). Here is the screenshot of the date and time columns. Is there a direct way in Igor pro to combine them to a new "date-time" column as the excel does? I didn't do it in Excel because the dataset is too long to be read into Excel, but Igor has the capacity to read the data.

In reply to by hegedus

Thank you. I imported them as text because they won't show correctly at the time part with added 01/01/1904 (UTC?). Here is the screenshot of the date and time columns. Is there a direct way in Igor pro to combine them to a new "date-time" column as the excel does? I didn't do it in Excel because the dataset is too long to be read into Excel, but Igor has the capacity to read the data.

I have posted a snippet showing how to do this conversion.

It would be better to import the date as date/time. If you attach a sample file or sufficient subset of a file, I will see if that is possible.