Quote from PaulJonestindall on September 18, 2019, 12:47 pmI need to be able to tell the hours between a start date and time and an end date and time.
For example: From 9/16/2019 14:00:00 to 9/17/2019 01:15:00 is 11.25 hours
Any suggestions?
Thanks.
I have found the plugin NeoToolBox somewhat useful with it's counter feature but there is no way to give it a specified stop time.
I need to be able to tell the hours between a start date and time and an end date and time.
For example: From 9/16/2019 14:00:00 to 9/17/2019 01:15:00 is 11.25 hours
Any suggestions?
Thanks.
I have found the plugin NeoToolBox somewhat useful with it's counter feature but there is no way to give it a specified stop time.
Quote from Gaev on September 18, 2019, 6:15 pm@pauljonestindall
There are two ways to approach this ...
1) using only native VisualNEOWin commands
- use StrParse to separate the dates from the hours:minutes:seconds
- use DateToNum to convert the date part(s) to 'days since December 30 1899'
- subtract the two numbers to get the 'difference in days'
- multiply by 24 to get hours- convert the two hh:mm:ss parts to hours
- if end hour is greater than start hour, add 'end-hour less start-hour' to date hours (calculated above)
- if end hour is equal to start hour, do nothing
- if end hour is less than start hour, add 'start-hour less end-hour less 24' to the date hours (calculated above)2) using Javascript code that you would use via a Call command ... Javascript has functions that give you difference between two dates/times in milliseconds ... so, it is a bit more straight forward.
Which one do you prefer ?
There are two ways to approach this ...
1) using only native VisualNEOWin commands
- use StrParse to separate the dates from the hours:minutes:seconds
- use DateToNum to convert the date part(s) to 'days since December 30 1899'
- subtract the two numbers to get the 'difference in days'
- multiply by 24 to get hours
- convert the two hh:mm:ss parts to hours
- if end hour is greater than start hour, add 'end-hour less start-hour' to date hours (calculated above)
- if end hour is equal to start hour, do nothing
- if end hour is less than start hour, add 'start-hour less end-hour less 24' to the date hours (calculated above)
2) using Javascript code that you would use via a Call command ... Javascript has functions that give you difference between two dates/times in milliseconds ... so, it is a bit more straight forward.
Which one do you prefer ?
Quote from PaulJonestindall on September 18, 2019, 7:21 pmGaev.
I will try working on a version of your first suggestion. As for the second suggestion, I'm not that familiar JavaScript but I have seen several different scripts online and I've never attempted to use it with NB.
I was hopeful though that someone else might have tackled this before. When I do, I'll post my solution or coding for everyone.
Thanks for the help.
Gaev.
I will try working on a version of your first suggestion. As for the second suggestion, I'm not that familiar JavaScript but I have seen several different scripts online and I've never attempted to use it with NB.
I was hopeful though that someone else might have tackled this before. When I do, I'll post my solution or coding for everyone.
Thanks for the help.