1. Subtract Time (seconds) from a DateTime Sequence
- Posted by cp Jun 28, 2013
- 1295 views
Looking for a simple and effective way to subtract time (in seconds) from a datetime sequence. For example I have the sequence {2012,3,1,0,0,30). If I subtract 60 seconds from it, it should produce the sequence {2012,2,29,23,59,30} I believe.
Supporting the subtraction of up to 86400 seconds is sufficient (1day) I know version 4.x has some useful date/time functions but this is a v3.1 program which cannot be upgraded for the moment.
Any thoughts appreciated.
2. Re: Subtract Time (seconds) from a DateTime Sequence
- Posted by jimcbrown (admin) Jun 28, 2013
- 1332 views
Looking for a simple and effective way to subtract time (in seconds) from a datetime sequence. For example I have the sequence {2012,3,1,0,0,30). If I subtract 60 seconds from it, it should produce the sequence {2012,2,29,23,59,30} I believe.
Supporting the subtraction of up to 86400 seconds is sufficient (1day) I know version 4.x has some useful date/time functions but this is a v3.1 program which cannot be upgraded for the moment.
Any thoughts appreciated.
Looking at the pre-4.1 code, I don't see any 4.1 or 4.0 specific features being used in the subtraction/addition routines. You can probably copy and paste most of the necessary code into your 3.1 program.
3. Re: Subtract Time (seconds) from a DateTime Sequence
- Posted by useless_ Jun 28, 2013
- 1270 views
Looking for a simple and effective way to subtract time (in seconds) from a datetime sequence. For example I have the sequence {2012,3,1,0,0,30). If I subtract 60 seconds from it, it should produce the sequence {2012,2,29,23,59,30} I believe.
Supporting the subtraction of up to 86400 seconds is sufficient (1day) I know version 4.x has some useful date/time functions but this is a v3.1 program which cannot be upgraded for the moment.
Any thoughts appreciated.
Looking at the pre-4.1 code, I don't see any 4.1 or 4.0 specific features being used in the subtraction/addition routines. You can probably copy and paste most of the necessary code into your 3.1 program.
Can't you include std/datetime.e, subtract your seconds from from_unix(), then use now() to convert to the {2012,3,1,0,0,30) format?
useless
4. Re: Subtract Time (seconds) from a DateTime Sequence
- Posted by jimcbrown (admin) Jun 28, 2013
- 1270 views
Can't you include std/datetime.e, subtract your seconds from from_unix(), then use now() to convert to the {2012,3,1,0,0,30) format?
The file as a whole has a few instances where it uses newer 4.0 constructs, so this wouldn't work without some tweaking.
But, that is a viable option imvho.
5. Re: Subtract Time (seconds) from a DateTime Sequence
- Posted by useless_ Jun 29, 2013
- 1226 views
Can't you include std/datetime.e, subtract your seconds from from_unix(), then use now() to convert to the {2012,3,1,0,0,30) format?
The file as a whole has a few instances where it uses newer 4.0 constructs, so this wouldn't work without some tweaking.
But, that is a viable option imvho.
I think both of these, in the archives, are pre-4.0:
http://www.rapideuphoria.com/datetime.zip has a subtract function.
http://www.rapideuphoria.com/datetime2.zip has a date.e.
useless