Need all the timestamp between two dates.

Himanshu_Pant
Himanshu_Pant New Altair Community Member
edited November 5 in Community Q&A
I have a dataset which consist of timestamp. The timestamp are in a gap of 15 mins. If I have two dates stored into macros ( e.g. first_date, last_date), how can I fetch all the timestamp between two macros? Example:
2020-08-15T02:30:00.000Z
2020-08-15T02:45:00.000Z
2020-08-15T03:00:00.000Z
2020-08-15T03:15:00.000Z
2020-08-15T03:30:00.000Z
2020-08-15T03:45:00.000Z
2020-08-15T04:00:00.000Z
2020-08-15T04:15:00.000Z

lets say first macro i.e. first_date = 2020-08-15T02:30:00.000Z and second macro i.e. last_date = 2020-08-15T03:30:00.000Z. So with these two macro I want  5 timestamp as an output starting from 2020-08-15T02:30:00.000Z  and ending with 2020-08-15T03:30:00.000Z.

Best Answer

Answers

  • MartinLiebig
    MartinLiebig
    Altair Employee
    Hi,
    the operator Create ExampleSet has an option called Date Series. You should be able to create this there.
    Best,
    Martin
  • Himanshu_Pant
    Himanshu_Pant New Altair Community Member
    Hi Martin,

    Thanks for the solution. But can we put ExampleSet in a loop (loop attribute)?
  • MartinLiebig
    MartinLiebig
    Altair Employee
    I am sorry, I am not sure I understand the question? Do you want to loop over those dates? If yes - Loop Values can do this.
  • Himanshu_Pant
    Himanshu_Pant New Altair Community Member
    For example I have 10 time stamps. 
    2019-04-10T18:45:00.000Z
    2019-04-21T17:45:00.000Z
    2019-05-02T17:00:00.000Z
    2019-05-11T10:45:00.000Z
    2019-05-21T13:00:00.000Z
    2019-05-30T05:15:00.000Z
    2019-06-10T07:30:00.000Z
    2019-06-25T01:30:00.000Z
    2019-07-22T04:00:00.000Z
    2019-07-29T04:00:00.000Z
    2019-08-05T04:00:00.000Z

    For each time stamp, I want last 24 hours of data in the gap of 15 mins. So for first time stamp i.e.
    2019-04-10T18:45:00.000Z, the output will be: 
    2019-04-09T18:45:00.000Z
    2019-04-09T19:00:00.000Z
    2019-04-09T19:15:00.000Z
    2019-04-09T19:30:00.000Z
    2019-04-09T19:45:00.000Z
    2019-04-09T20:00:00.000Z
    2019-04-09T20:15:00.000Z
    2019-04-09T20:30:00.000Z
    2019-04-09T20:45:00.000Z
    2019-04-09T21:00:00.000Z
    2019-04-09T21:15:00.000Z
    2019-04-09T21:30:00.000Z
    2019-04-09T21:45:00.000Z
    2019-04-09T22:00:00.000Z
    2019-04-09T22:15:00.000Z
    2019-04-09T22:30:00.000Z
    2019-04-09T22:45:00.000Z
    2019-04-09T23:00:00.000Z
    2019-04-09T23:15:00.000Z
    2019-04-09T23:30:00.000Z
    2019-04-09T23:45:00.000Z
    2019-04-10T00:00:00.000Z
    2019-04-10T00:15:00.000Z
    2019-04-10T00:30:00.000Z
    2019-04-10T00:45:00.000Z
    2019-04-10T01:00:00.000Z
    2019-04-10T01:15:00.000Z
    2019-04-10T01:30:00.000Z
    2019-04-10T01:45:00.000Z
    2019-04-10T02:00:00.000Z
    2019-04-10T02:15:00.000Z
    2019-04-10T02:30:00.000Z
    2019-04-10T02:45:00.000Z
    2019-04-10T03:00:00.000Z
    2019-04-10T03:15:00.000Z
    2019-04-10T03:30:00.000Z
    2019-04-10T03:45:00.000Z
    2019-04-10T04:00:00.000Z
    2019-04-10T04:15:00.000Z
    2019-04-10T04:30:00.000Z
    2019-04-10T04:45:00.000Z
    2019-04-10T05:00:00.000Z
    2019-04-10T05:15:00.000Z
    2019-04-10T05:30:00.000Z
    2019-04-10T05:45:00.000Z
    2019-04-10T06:00:00.000Z
    2019-04-10T06:15:00.000Z
    2019-04-10T06:30:00.000Z
    2019-04-10T06:45:00.000Z
    2019-04-10T07:00:00.000Z
    2019-04-10T07:15:00.000Z
    2019-04-10T07:30:00.000Z
    2019-04-10T07:45:00.000Z
    2019-04-10T08:00:00.000Z
    2019-04-10T08:15:00.000Z
    2019-04-10T08:30:00.000Z
    2019-04-10T08:45:00.000Z
    2019-04-10T09:00:00.000Z
    2019-04-10T09:15:00.000Z
    2019-04-10T09:30:00.000Z
    2019-04-10T09:45:00.000Z
    2019-04-10T10:00:00.000Z
    2019-04-10T10:15:00.000Z
    2019-04-10T10:30:00.000Z
    2019-04-10T10:45:00.000Z
    2019-04-10T11:00:00.000Z
    2019-04-10T11:15:00.000Z
    2019-04-10T11:30:00.000Z
    2019-04-10T11:45:00.000Z
    2019-04-10T12:00:00.000Z
    2019-04-10T12:15:00.000Z
    2019-04-10T12:30:00.000Z
    2019-04-10T12:45:00.000Z
    2019-04-10T13:00:00.000Z
    2019-04-10T13:15:00.000Z
    2019-04-10T13:30:00.000Z
    2019-04-10T13:45:00.000Z
    2019-04-10T14:00:00.000Z
    2019-04-10T14:15:00.000Z
    2019-04-10T14:30:00.000Z
    2019-04-10T14:45:00.000Z
    2019-04-10T15:00:00.000Z
    2019-04-10T15:15:00.000Z
    2019-04-10T15:30:00.000Z
    2019-04-10T15:45:00.000Z
    2019-04-10T16:00:00.000Z
    2019-04-10T16:15:00.000Z
    2019-04-10T16:30:00.000Z
    2019-04-10T16:45:00.000Z
    2019-04-10T17:00:00.000Z
    2019-04-10T17:15:00.000Z
    2019-04-10T17:30:00.000Z
    2019-04-10T17:45:00.000Z
    2019-04-10T18:00:00.000Z
    2019-04-10T18:15:00.000Z
    2019-04-10T18:30:00.000Z
    2019-04-10T18:45:00.000Z


  • MartinLiebig
    MartinLiebig
    Altair Employee
    So you put a loop around the Create Example Set with the start date as a macro?

    Best,
    Martin
  • Himanshu_Pant
    Himanshu_Pant New Altair Community Member
    Well I add a loop attribute to the input data set which consist of these 11 time stamps. Inside loop attribute, I connect a multiply operator. 
    From multiply operator, one connection goes to extract macro which will store the first timestamp. The other goes to adjust date which will adjust the date by one day. This will connect to second macro which will store the previous day. Lets say first date is 2019-04-10T18:45:00.000Z. So the first macro (%{last_date}) will store 2019-04-10T18:45:00.000Z and other macro  (%{first_date}) will store 2019-04-09T18:45:00.000Z. After this, I used equalize time stamps where I selected equalize method: Range, Start value: custom, custome start date: %{first_date} , Stop value: custom, custome stop date: %{last_date} , step size: 15 mins and replace type date time: liner interpolation. 
    However this is giving me an error: Process failed (Text '10/04/2019 18:45:00 PM UTC' could not be parsed).

    Please suggest another method for the problem statement.
  • YYH
    YYH
    Altair Employee
    edited June 2021
    Hi @Himanshu_Pant

    It looks the timestamp needs some conversion from the macro according to the error message. If possible, are you able to share the .xml/.rmp file here?

    Cheers,
    YY
  • Himanshu_Pant
    Himanshu_Pant New Altair Community Member
    Let me know if any other information is required.
  • Himanshu_Pant
    Himanshu_Pant New Altair Community Member
    Hi @mschmitz,

    Kindly help me with this please.
  • YYH
    YYH
    Altair Employee
    Answer ✓
    Hi @Himanshu_Pant, I did not understand "loop Attributes" in your process and replaced it with loop examples that create new timestamps with 15 min interval. See attached.
  • Himanshu_Pant
    Himanshu_Pant New Altair Community Member
    Hi @yyhuang,

    Thanks a lot for your solution. Please help me in future as well.