Use any DATE as "offset" input for time functions

Posted By: AndrewAMD

Use any DATE as "offset" input for time functions - 07/21/19 21:14

jcl,

There are several time and calendar functions, here:
https://manual.zorro-project.com/month

As an input, the user can currently supply offset=NOW, or any given bar offset.

It would be nice if any arbitrary date can be used as an input as well.

It can be as simple as this:
New function: void setThisDate(var Date); // This sets the Date referenced by offset=THISDATE

Now you use the newly defined offset=THISDATE to use any of these date functions with any date.

Thanks,
Andrew
Posted By: jcl

Re: Use any DATE as "offset" input for time functions - 07/22/19 05:40

What's wrong with the current offset = Date method?
Posted By: AndrewAMD

Re: Use any DATE as "offset" input for time functions - 07/22/19 10:20

If I understand, the DATE input only allows int input and therefore I cannot use time of day functions, only daily. I was hoping to use the full var for time of day calculations, using time zones.

If it's easier, maybe allow a unix time input, since it's already an int, but in seconds.
Posted By: jcl

Re: Use any DATE as "offset" input for time functions - 07/23/19 07:15

We plan overloaded time functions for a future version that accept vars. Currently you can set Now to a Date and then use NOW for the offset.
Posted By: AndrewAMD

Re: Use any DATE as "offset" input for time functions - 07/23/19 10:23

Thank you, and thanks for the workaround.
© 2024 lite-C Forums