FormerMember

Convert ProvideX TIM to seconds

Posted By FormerMember

Is there a way to convert a ProvideX TIM / TME based value to seconds? The JUL() function only works with dates.

This is how ScriptBasic's TIMEVALUE works.

scriptbasic.org/.../ug_25.175.html

  • You can use the DTE function.  Entering a 0 for the date will use current date.  to convert 10 1/2 hours to seconds timeInSeconds$=DTE(0,10.5:"%S") results in timeInSeconds$=37800

  • FormerMember
    FormerMember in reply to daburke

    Thank You!

    I tried DTE() but failed to use the %S mask. I'm curious why it has to be a string to receive the numeric seconds results.

    *WISH* -  Use the ScriptBasic TIMEVALUE C code to enhance ProvideX's JUL() function.

  • FormerMember
    FormerMember in reply to daburke

    I'm trying to get the number of seconds since 1/1/1970. The ProvideX JUL() function returns days since that that date. If I multiply it by the seconds in a day (86,400) the returned value isn't correct.

    ->print JUL(2021,10,7)
     2459495
    ->print JUL(2021,10,7) * 86400
     212500368000
    ->

    The correct value should be 1633564800

    ProvideX should be returning 18907 for the number of days using my date example.

    ->print 18907 * 86400
     1633564800

    ->

    The 'BY' value = 0

    If you want the JUL( ) function to return dates based roughly on the Julian calendar, set the 'BY' system parameter to 0 (zero).

    I started the Sage ProvideX session by clicking on pvxwin32.exe in the Windows Explorer.

    The JUL( ) function is used to convert a date from year, month, day to a Julian date. The Julian date is an integer: the number of days since the system base date. By default, this is January 1, 1970. Use the 'BY' system parameter to change the base date.

    RESOLVED

    ->SET_PARAM 'BY'=1970
    ->PRINT JUL(2021,10,7)
     18907
    ->