time calculations

Questions, tips and tricks and techniques for scripting in Servoy

time calculations

Postby Harjo » Wed Jul 02, 2003 2:15 pm

I have two fields:

tijdvan (DATETIME) format HH:mm
tijdtm (DATETIME) format HH:mm

and a calculation: werktijd (DATETIME & STORED)
which contains:

return tijdtm - tijdvan;

If I fill in the two fieldsL tijdvan & tijdtm with for example: 16:30 and 17:00 nothing happens, I want the result 00:30.

What am I doing wrong?
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Postby maarten » Wed Jul 02, 2003 10:26 pm

return tijdtm - tijdvan;

try this: tijdm.getTime() - tijdvan.getTime()
(substraction in milliseconds)

However, your code (substracting Objects) should also work from JS 1.3
I'll check with dev team why this doesn't work.
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby Harjo » Thu Jul 03, 2003 12:09 am

That does'nt work!
It doesn't mather what I fill in, it returns: 01-01-1970
????

Is there any other option, because we do a lot of time-calculations in our solutions!
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Postby maarten » Thu Jul 03, 2003 9:19 am

did you format your calculationResult to HH:mm?
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby Harjo » Thu Jul 03, 2003 9:51 am

Yep it works
thanks
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands


Return to Methods

Who is online

Users browsing this forum: No registered users and 10 guests

cron