Join using Date and Time

Jon Dix
Jon Dix Altair Community Member
edited September 2020 in Community Q&A
​Hey,

We are trying to compare transaction logs and are trying to make a join using a date field and a time field. We think the issue we are running into is one of the reports is showing the time as HH:MM:00, while the other is showing it with the actual seconds (HH:MM:SS). What is the best way to drop the seconds on both so that we can join. We tried everything we can think of, but our brain power is running out so there probably are a number of easy, common sense ways to do it that we aren't thinking of.

Thanks!

------------------------------
Jon Dix
Research Analyst
Founders Federal Credit Union
Lancaster SC
(803) 289-5277
------------------------------
Tagged:

Answers

  • Rebecca_Cronin
    Rebecca_Cronin
    Altair Employee
    edited September 2020
    Hi Jon, 

    Did you try selecting the column and use the FORMAT Option from the drop-down menu and then selecting the CUSTOM Option to allow you to define how you would like to define the date/time field.  From CUSTOM- select the fields you want.  Note:  you may want to double check the field is on the date field. 

    Format Date/Time - Custom




    ------------------------------
    Rebecca Cronin
    Customer Success Manager
    Bedford MA
    (978) 275-8203
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 09-01-2020 04:12 PM
    From: Jon Dix
    Subject: Join using Date and Time

    Hey,

    We are trying to compare transaction logs and are trying to make a join using a date field and a time field. We think the issue we are running into is one of the reports is showing the time as HH:MM:00, while the other is showing it with the actual seconds (HH:MM:SS). What is the best way to drop the seconds on both so that we can join. We tried everything we can think of, but our brain power is running out so there probably are a number of easy, common sense ways to do it that we aren't thinking of.

    Thanks!

    ------------------------------
    Jon Dix
    Research Analyst
    Founders Federal Credit Union
    Lancaster SC
    (803) 289-5277
    ------------------------------
    "
  • Steve Caiels_21881
    Steve Caiels_21881
    Altair Employee
    edited September 2020

    Hi Jon,

    I think you are correct in determining that it is the seconds that are stopping your rows from joining. The format is primarily a visual setting, so even if you choose a format that excludes some of the components, it is still in the underlying data and will prevent the join.

    For example, with the two text files below, only Data Line 2 and B will 'INNER' join; regardless of the formatting options.

    image

    ** Edit - the lower screen shot was taken when date & time were in one field. It should have looked like this . . . 

    image



    If you don't mind losing the seconds component from the time, then the following should resolve it.

    • Ensure that the time is formatted to include exclude seconds. It should look identical in the table, but as you have seen, will not join at this stage. For me, the built in 'Time' format works, but this will depend on your Windows Regional Settings, so you may need to define a custom format.
    • Convert the column to Character by clicking on the clock symbol in the column heading and changing it to Ab
    • Your join should now match as expected (excluding seconds)
      image


    You can change the columns back to Date/Time in the joined table if you need to export a true date/time field.

    If you need to retain seconds or can't change the column to character for other reasons, you will need to duplicate the column before making any changes, then edit one 'set' to perform the join.

    Alternatively, you could create a new genuine date/time calculated column containing the date/time without the seconds component by subtracting the number of seconds from the original value.

    image
    image


    Regards,

    Steve.

    ------------------------------
    Steve Caiels
    Professional Services
    Altair
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 09-01-2020 04:12 PM
    From: Jon Dix
    Subject: Join using Date and Time

    Hey,

    We are trying to compare transaction logs and are trying to make a join using a date field and a time field. We think the issue we are running into is one of the reports is showing the time as HH:MM:00, while the other is showing it with the actual seconds (HH:MM:SS). What is the best way to drop the seconds on both so that we can join. We tried everything we can think of, but our brain power is running out so there probably are a number of easy, common sense ways to do it that we aren't thinking of.

    Thanks!

    ------------------------------
    Jon Dix
    Research Analyst
    Founders Federal Credit Union
    Lancaster SC
    (803) 289-5277
    ------------------------------"
  • Jon Dix
    Jon Dix Altair Community Member
    edited September 2020

    Hi Jon,

    I think you are correct in determining that it is the seconds that are stopping your rows from joining. The format is primarily a visual setting, so even if you choose a format that excludes some of the components, it is still in the underlying data and will prevent the join.

    For example, with the two text files below, only Data Line 2 and B will 'INNER' join; regardless of the formatting options.

    image

    ** Edit - the lower screen shot was taken when date & time were in one field. It should have looked like this . . . 

    image



    If you don't mind losing the seconds component from the time, then the following should resolve it.

    • Ensure that the time is formatted to include exclude seconds. It should look identical in the table, but as you have seen, will not join at this stage. For me, the built in 'Time' format works, but this will depend on your Windows Regional Settings, so you may need to define a custom format.
    • Convert the column to Character by clicking on the clock symbol in the column heading and changing it to Ab
    • Your join should now match as expected (excluding seconds)
      image


    You can change the columns back to Date/Time in the joined table if you need to export a true date/time field.

    If you need to retain seconds or can't change the column to character for other reasons, you will need to duplicate the column before making any changes, then edit one 'set' to perform the join.

    Alternatively, you could create a new genuine date/time calculated column containing the date/time without the seconds component by subtracting the number of seconds from the original value.

    image
    image


    Regards,

    Steve.

    ------------------------------
    Steve Caiels
    Professional Services
    Altair
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 09-01-2020 04:12 PM
    From: Jon Dix
    Subject: Join using Date and Time

    Hey,

    We are trying to compare transaction logs and are trying to make a join using a date field and a time field. We think the issue we are running into is one of the reports is showing the time as HH:MM:00, while the other is showing it with the actual seconds (HH:MM:SS). What is the best way to drop the seconds on both so that we can join. We tried everything we can think of, but our brain power is running out so there probably are a number of easy, common sense ways to do it that we aren't thinking of.

    Thanks!

    ------------------------------
    Jon Dix
    Research Analyst
    Founders Federal Credit Union
    Lancaster SC
    (803) 289-5277
    ------------------------------"
    Thank you Steve! We will be trying this method this afternoon. We had tried something similar but it was toward the end of a particularly rough day and so we probably missed a step in there.

    ------------------------------
    Jon Dix
    Research Analyst
    Founders Federal Credit Union
    Lancaster SC
    (803) 289-5277
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 09-02-2020 05:35 AM
    From: Steve Caiels
    Subject: Join using Date and Time

    Hi Jon,

    I think you are correct in determining that it is the seconds that are stopping your rows from joining. The format is primarily a visual setting, so even if you choose a format that excludes some of the components, it is still in the underlying data and will prevent the join.

    For example, with the two text files below, only Data Line 2 and B will 'INNER' join; regardless of the formatting options.

    image

    ** Edit - the lower screen shot was taken when date & time were in one field. It should have looked like this . . . 

    image



    If you don't mind losing the seconds component from the time, then the following should resolve it.

    • Ensure that the time is formatted to include exclude seconds. It should look identical in the table, but as you have seen, will not join at this stage. For me, the built in 'Time' format works, but this will depend on your Windows Regional Settings, so you may need to define a custom format.
    • Convert the column to Character by clicking on the clock symbol in the column heading and changing it to Ab
    • Your join should now match as expected (excluding seconds)
      image


    You can change the columns back to Date/Time in the joined table if you need to export a true date/time field.

    If you need to retain seconds or can't change the column to character for other reasons, you will need to duplicate the column before making any changes, then edit one 'set' to perform the join.

    Alternatively, you could create a new genuine date/time calculated column containing the date/time without the seconds component by subtracting the number of seconds from the original value.

    image
    image


    Regards,

    Steve.

    ------------------------------
    Steve Caiels
    Professional Services
    Altair
    ------------------------------

    Original Message:
    Sent: 09-01-2020 04:12 PM
    From: Jon Dix
    Subject: Join using Date and Time

    Hey,

    We are trying to compare transaction logs and are trying to make a join using a date field and a time field. We think the issue we are running into is one of the reports is showing the time as HH:MM:00, while the other is showing it with the actual seconds (HH:MM:SS). What is the best way to drop the seconds on both so that we can join. We tried everything we can think of, but our brain power is running out so there probably are a number of easy, common sense ways to do it that we aren't thinking of.

    Thanks!

    ------------------------------
    Jon Dix
    Research Analyst
    Founders Federal Credit Union
    Lancaster SC
    (803) 289-5277
    ------------------------------"