What is the correct syntax for the date_diff function. RapidMiner version 10.1

HemalS
HemalS New Altair Community Member
edited November 2024 in Community Q&A
floor(date_diff(Dt_Customer, date_parse_str("2014-06-30", "YYYY-MM-DD","us"), DATE_UNIT_DAY, "America/Newyork"))


This function does not resolve. Gives 'unable to obtain ZonedDatetime for TemporalAccess'
Tagged:

Answers

  • Kevin_Majchrzak
    Kevin_Majchrzak New Altair Community Member
    Hi HemalS,

    thank you for reaching out to us! This should work:
    floor(date_diff(Dt_Customer, date_parse_str("2014-06-30 00:00 America/New_York", "yyyy-MM-dd HH:mm VV","us"), DATE_UNIT_DAY, "America/New_York"))

    The problems with the original expression were:
    • you need to use yyyy instead of YYYY
    • the time and time zone for date_parse_str were missing
    • the parser expects "America/New_York" instead of "America/Newyork"
    Most valid time zone formats can be found here:
    https://docs.oracle.com/middleware/12211/wcs/tag-ref/MISC/TimeZones.html
    Some additional ones like, for example, "CET" are also allowed.

    We understand that it is inconvenient that you now have to specify the time and time zone and we are investigating how we can improve the user experience in that regard. Most likely, we will have a default time of 00:00:00.000000000 if no time is specified. Unfortunately, we will probably have to keep the time zone requirement, though. This assures that your process produces the same results regardless of you physical location.

    Sorry for the inconvenience! Have a nice day!  :)
    Kevin
  • HemalS
    HemalS New Altair Community Member
    Thank you so much for your response and the clarifications, Kevin! It works and answers my question.