If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
-
tkietboi
- Posts: 2
- Joined: 2020-06-15 12:26
Post
by tkietboi » 2020-06-16 10:04
Hi,
I'm having this situation, I wanna calculate
totalTime = endDate - startDate
Screenshot here:
https://drive.google.com/file/d/1cG-p8N ... p=drivesdk
My calculated field now of totalTime, Data type is Time
Code: Select all
SELECT * , SEC_TO_TIME(TIMESTAMPDIFF(HOUR,`timesheet`.`endDate`,`timesheet`.`startDate`) *60) as `timesheet`.`totalTime`
FROM `timesheet`
Did I do something wrong?
Thank you for your helping!
-
pbottcher
- AppGini Super Hero
- Posts: 1638
- Joined: 2018-04-01 10:12
Post
by pbottcher » 2020-06-16 19:21
Hi,
if I see that correctly you try to convert minutes instead of seconds, next you only need to return one value from the SQL query and you should apply the query to the record id.
So you might try
Code: Select all
SELECT SEC_TO_TIME(TIMESTAMPDIFF(HOUR,`timesheet`.`endDate`,`timesheet`.`startDate`) *60*60) as `totalTime`
FROM `timesheet` WHERE ID=%ID%
Assuming that your PK field is ID.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
-
tkietboi
- Posts: 2
- Joined: 2020-06-15 12:26
Post
by tkietboi » 2020-06-17 04:51
Yeahhh yesterday I already did with this
Code: Select all
SELECT SEC_TO_TIME(TIMESTAMPDIFF(SECOND,`timesheet`.`startDate`,`timesheet`.`endDate`))
FROM `timesheet`
WHERE `timesheet`.`id`='%ID%'
But anyway, thank you for your supporting.
This will note for me and anyone need after that!