Hi,
Please, I need some help on solve issues related to calculate date/time. I would like to use the functions not to programming.
See what I have:
SCENARIO #1 (simple date)
-----DATE-------TIME1--------TIME2
06/14/2020 12:40 (pm) 05:20 (pm)
Using DateDiff(time2, time1), I am able to get the correct value: 04:40:00, but how I can multiply this value by US$ 25.00? How I convert it into a numeric field?
I would like to do: ((4*60+40)/60)*25 = result.
SCENARIO #2 (more complex and date/time)
-----DATE-------TIME1--------TIME2
06/14/2020 09:00 (am) 02:00 (pm)
06/15/2020 10:00 (am) 05:00 (pm)
06/16/2020 07:00 (pm) 08:00 (am) ---> started the day at night, but ended the day in the next day
I need to get the total of hour, and then to multiply by US$ 25.00/hour. How can I do it?
Tks.
DATEDIFF - TOTAL HOURs
-
- Posts: 35
- Joined: Mon Jan 29, 2018 11:04 am
-
- Posts: 35
- Joined: Mon Jan 29, 2018 11:04 am
Re: DATEDIFF - TOTAL HOURs
Hi,
Just updating.
For the first sceario, it seems that it is better to use:
(Hour(time2)*60+Minute(time2)-Hour(time1)*60+Minute(time1))/60 - but the problem is that th result is integer (it is rounded), and I would like a decimal value (not rounded).
tks.
Just updating.
For the first sceario, it seems that it is better to use:
(Hour(time2)*60+Minute(time2)-Hour(time1)*60+Minute(time1))/60 - but the problem is that th result is integer (it is rounded), and I would like a decimal value (not rounded).
tks.
-
- Posts: 7338
- Joined: Tue Mar 20, 2018 5:34 am
Re: DATEDIFF - TOTAL HOURs
Hello,
Please try to use the following expression:
{DateDiff(Variable1,Variable2).Hours * hprice + DateDiff(Variable1,Variable2).Minutes * hprice / 60}
Thank you.
Please try to use the following expression:
{DateDiff(Variable1,Variable2).Hours * hprice + DateDiff(Variable1,Variable2).Minutes * hprice / 60}
Thank you.
-
- Posts: 35
- Joined: Mon Jan 29, 2018 11:04 am
Re: DATEDIFF - TOTAL HOURs
Hi, I solved it, at this moment, using:
{Div(Hour(xxxx)*60+Minutes(xxxx),60)}, with this, I have the hours to be multiplied to the price.
Thank you.
{Div(Hour(xxxx)*60+Minutes(xxxx),60)}, with this, I have the hours to be multiplied to the price.
Thank you.
Re: DATEDIFF - TOTAL HOURs
Hello,
Okay, great! Thank you for sharing your solution.
Stay safe!
Okay, great! Thank you for sharing your solution.
Stay safe!