Is there a method that takes two dates and returns the number of days difference.
I have a work order number that I want to know how long it has been there… Initially I plan to use timer, but thinking if I could just subtract the work order time stamp from current time stamp.
See below for given data (each column stored on PAC Table):
item 1, 04/20/2019, <elapse time in days here>
item 2, 04/22/2019, <elapse time in days here>
…
item 10, 04/25/2019, <elapse time in days here>
The third column is the table for elapse time.
I am trying to come up with a code, to loop thru each row.
Subtract 2nd Column (Date stamp), from Current Date and save it on corresponding index of 3rd column. Every 1 min or so.
Number of Items can be much more.
Well, PAC can only store 1 dimension table, and 1 data type. So yes, it is separate table.
Yes, first and 2nd column is string.
Yes, I can parse.
Do you have something like this in mind:
function (subroutine in this case) that takes two argument mm/dd/yyyy, and returns an interger.
Is this essentially what Mary’s codes does?
Yes, I’m aware, just verifying that it wasn’t a comma separated string in a single table.
I would parse out the month, day and year and put them into an integer table in the date/time format as specified in the PAC Control command help for the GetDateTime command. Convert this value to an int64 NTP timestamp using the DateTimeToNtpTimestamp command. Do the same with the current time. Subtract the two int64 values that the Ntp command generates and divide the result by the constant (2^32 * 86400 = 371,085,174,374,400). That should get you the difference in days.
If you can store the NTP timestamp when the work order is generated in an int64 table, that would make things simpler.
I am new to creating subroutine, is it possible to create subroutine, to call it and return current int64 NTP_TimeStamp data. This way, I do not have to use an Integer32_Table on my current strategy.
Yes, you can call GetDateTime in a subroutine using a local int32 table, and then pass that to the DateTimeToNtpTimestamp to get the int64 timestamp.
A subroutine doesn’t “return” anything, it can only act on the parameters passed to it, in your case you would pass in the int64 variable that you want the timestamp to be stored in.
I have 9 running charts that I want to get NTP_TimeStamp.
So I need to create 9 integer_table with 8 elements. and 9 integer64 variables.
I would run GetDateTime and followed by DateTimeToNtpTimestamp, on each charts.
I plan to use subroutine, so that, I save myself creating 9 integer_table.
Believing that, calling a subroutine will create its own instance.
But I learned that calling the same subroutine simultaneously is not a good practice.
Doesn’t matter who told me, any experience on this?
Realizing what you said means, main purpose of subroutine will be defeated.
And it is also state on manual, that subroutine will be displayed on the command list, just like other commands - in that context you can treat subroutine like other commands…
(I now believe this is the case. And tested. Works just fine. )