I need a function with parameters as follows
a = addhours("15/12/1999 10:07:23 PM",1)
This would return the time/date specified + 1 hour so it would be:
15/12/1999 11:07:23 PM
I can do this with string manipulation, but the trouble is when adding large amounts of hours, or adding negative figures.
If I want to set the time back 3 hours I want to be able to do
a = addhours("15/12/1999 10:07:23 PM",-3)
and also it must change the date if necessary. So if for example the hours forward are 37, then the day would obviously go forward.
This is more complicated than it first seems, especially setting forward the month/year etc..
The time should be in the format of 'now'
If you do:
you will get the correct date/time format
(what I mean by this is that it will change from dd/mm/yyyy to mm/dd/yyyy in USA. It MUST work for both.