I figured it out. No need for help. Just a little persistence. Here is the code to accomplish it with a print statement output you can try out. I did not try it over the midnight time span. I don't need to worry about this myself.
You could wrap the (long hard to remember) commands shown in the print statement into a simpler easier to remember set of functions that clutter your EL code less.
result = TimeAdd_s(time_s,OneSecond);
result = TimeSubtract_s(time_s,OneHour);
John.
Code: Select all
variables:
OneHour(1/24), {1 divided by the number of hours in a day}
OneMinute(1/1440), {1 divided by the number of minutes in a day}
OneSecond(1/86400); {1 divided by the number of seconds in a day}
Print( File("C:\Access\A_DateTimeLearningTests.txt"),
" Time_s", " " ,
Time_s, " --- " ,
" add 1Sec", " " ,
DateTime2ELTime_s(ELTimeToDateTime_s(Time_s) + OneSecond) , " " ,
" add 1min", " " ,
DateTime2ELTime_s(ELTimeToDateTime_s(Time_s) + OneMinute) , " " ,
" add 1hour", " " ,
DateTime2ELTime_s(ELTimeToDateTime_s(Time_s) + OneHour) , " " ,
" subtract 1Sec", " " ,
DateTime2ELTime_s(ELTimeToDateTime_s(Time_s) - OneSecond) , " " ,
" subtract 1min", " " ,
DateTime2ELTime_s(ELTimeToDateTime_s(Time_s) - OneMinute) , " " ,
" subtact 1hour", " " ,
DateTime2ELTime_s(ELTimeToDateTime_s(Time_s) - OneHour) , " " ,
" ");
Time_s 40630.00 --- add 1Sec 40631.00 add 1min 40730.00 add 1hour 50630.00 subtract 1Sec 40629.00 subtract 1min 40530.00 subtact 1hour 30630.00
Time_s 40640.00 --- add 1Sec 40641.00 add 1min 40740.00 add 1hour 50640.00 subtract 1Sec 40639.00 subtract 1min 40540.00 subtact 1hour 30640.00
Time_s 40650.00 --- add 1Sec 40651.00 add 1min 40750.00 add 1hour 50650.00 subtract 1Sec 40649.00 subtract 1min 40550.00 subtact 1hour 30650.00
Time_s 40700.00 --- add 1Sec 40701.00 add 1min 40800.00 add 1hour 50700.00 subtract 1Sec 40659.00 subtract 1min 40600.00 subtact 1hour 30700.00
Time_s 40710.00 --- add 1Sec 40711.00 add 1min 40810.00 add 1hour 50710.00 subtract 1Sec 40709.00 subtract 1min 40610.00 subtact 1hour 30710.00