I am trying to get the difference between two datetimes and display it in string as hh:mm
q.parambyname('vstart').asdatetime:= vstart;
q.parambyname('vend').asdatetime:= vend;
d:= vend-vstart;
mins:= d * 1440;
q.ParamByName('mins').asBCD:= mins;
currently the database stores it in minutes
example (0.39)
I would like to then take it from database and display it in the string format hh:mm
In DateUtils
there is a function MinutesBetween
which can be used as such:
m := MinutesBetween(vend,vstart);
yourHMStr := Format('%2.2d:%2.2d',[m div 60,m mod 60]);