I have a code section where I have to create new column hours by finding the difference between the current date and the minimum date (initial date) . But unfortunately i have tried a lot of things but i could not get to the solution.
// Convert "Date" from Character to Date format
col = Column(dtCombined, "Date");
col << Data Type("Numeric", Informat("y/m/d"), Format("d/m/y"));
col << Modeling Type("Continuous");
//Finding the initial date
initialDate = Col Minimum(dtCombined:Date);
Show("Earliest Date Found:", initialDate);
// Add "Hours" column as the first column
dtCombined << New Column("Hours",
Numeric,
Continuous,
Formula(Date Difference(:Date, initialDate, "Hour"))
);
Following are the things that i have tried -
None of these return 0 when initial date is subtracted with date value same as initial date -
Show(Date Difference(24 - 09 - 2024, 3809980800, "Hour"));
Show(Date Difference(24 - 09 - 2024, As Date(3809980800), "Hour"));
Show(Date Difference(As Date(24 - 09 - 2024), 3809980800, "Hour"));
Show(Date Difference(24 - 09 - 2024, As Date(Format(3809980800, "d/m/y", 10)), "Hour"));
Show(Date Difference(24 - 09 - 2024, Informat("3809980800", "d/m/y"), "Hour"));
initialD = Format(3809980800 + Informat("01/01/1904", "m/d/y"), "d/m/y");
Show(initialD);
k = Format(3809980800, "d/m/y");
Show(k);