I have a pretty unusual problem (for me). I am writing an application that will allow a user to change their system time forward or back either by explicit date (change my date to 6/3/1955) or by increment using buttons (go forward 1 month).
I'm writing this to help some of my users test some software that requires jumps like this in order to simulate real world usage of a billing system.
Changing the time in Delphi is of course very easy:
SetDateTime(2008,05,21,16,07,21,00);
But I'm not sure if Delphi (2006) has any built in helpers for date math, which is one of my least favorite things :)
Any suggestions for the best way to handle this? I'd prefer to stay native as the winapi datetime calls suck.
Thanks!
As mentioned by gabr and mliesen, have a look at the DateUtils and SysUtils units, useful functions include.
There is plenty of helpers in the DateUtils unit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With