| Author |
Message |
Elisha83
Groupie
Joined: 19 Feb 2008
Location: Malaysia
Online Status: Offline
Posts: 62
|

Topic: Getting the right time added shown Posted: 10 Sep 2009 at 12:13am |
Hi there~
I need help on getting the right added time shown. Below is the output I needed.
Start time : 10.30am
Repair time : 4.15 hours
Output wanted : 2.45pm
Output I get : 2.00pm
I only manage to get the hour shown correct. How can I make the minute shown correct too?Below are my formula.
DateAdd ("h", {ASSIGNS.ESTREPAIRHRS}+hour({ASSIGNS.STARTTIME}),{ASSIGNS.SCHEDDATE})
Please kindly advice on how I should type the formula in order to get the correct time shown?
Thanks in advance~
Elisha  Edited by Elisha83 - 10 Sep 2009 at 9:13pm
|
|
3Lish@
|
IP Logged |
|
|
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 10 Sep 2009 at 7:06am |
try using minutes. you only added hours (though I would have 2:30...and shouldn't it be 2:45?)
|
IP Logged |
|
Elisha83
Groupie
Joined: 19 Feb 2008
Location: Malaysia
Online Status: Offline
Posts: 62
|

Posted: 13 Sep 2009 at 7:04pm |
Sorry my mistake.The output that I wish to get is 2.45pm. If I change the formula below to minutes, it shows the wrong time.
DateAdd ("n", {ASSIGNS.ESTREPAIRHRS}+minute({ASSIGNS.STARTTIME}),{ASSIGNS.SCHEDDATE})
Is there any other way I can write the formula to add up the time?
Urgently need help on this.
Thanks in advance~
Elisha 
|
|
3Lish@
|
IP Logged |
|
Jyothi Yepuri
Senior Member
Joined: 11 May 2009
Location: Australia
Online Status: Offline
Posts: 127
|

Posted: 13 Sep 2009 at 8:25pm |
|
try
DateAdd ("n", ({ASSIGNS.ESTREPAIRHRS}*60)+minute({ASSIGNS.STARTTIME}),{ASSIGNS.SCHEDDATE})
is {ASSIGNS.ESTREPAIRHRS} no of hours?
Jyothi
|
IP Logged |
|
Elisha83
Groupie
Joined: 19 Feb 2008
Location: Malaysia
Online Status: Offline
Posts: 62
|

Posted: 13 Sep 2009 at 10:47pm |
Jyothi,
I try the formula already. But it gives me the wrong time also. {ASSIGNS.ESTREPAIRHRS} is number of hours enter by user.
|
|
3Lish@
|
IP Logged |
|
Jyothi Yepuri
Senior Member
Joined: 11 May 2009
Location: Australia
Online Status: Offline
Posts: 127
|

Posted: 13 Sep 2009 at 11:02pm |
|
try to convert 4.15 hours into minutes i.e 255minutes
and add those minutes to your {ASSIGNS.SCHEDDATE}
what exactly user enters? 4.15 hours or any datetime value?
Jyothi
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 14 Sep 2009 at 6:14am |
if the user enters the number of hours, you will need to multiple that number by 60 when you add by minutes. Once you have a time, you can interpret it however you want to...display it.
so, this should work:
DateAdd ("m", {ASSIGNS.ESTREPAIRHRS}*60,{ASSIGNS.STARTTIME})
this adds the estimated time to the start time....which should give the completed time. I don't know if adding the schedule date gets you a better number...if it is just a date, without time, then it shouldn't matter, but given the output desired, I wouldn't bother with date part.
|
IP Logged |
|
Elisha83
Groupie
Joined: 19 Feb 2008
Location: Malaysia
Online Status: Offline
Posts: 62
|

Posted: 15 Sep 2009 at 5:49am |
lockwelle,
I have test your formula.But it gives me error.
DateAdd ("m", {ASSIGNS.ESTREPAIRHRS}*60, {ASSIGNS.STARTTIME} )
It says that my assigns.starttime should be date value. But i try to put the date({assigns.startime}) formula, it still gives me error.
Anyway, it doesnt matter now. I manage to get the hour and minutes separately, but problem is my AM and PM show wrongly.
What kind of formula I should write to convert 10:30PM to 22:30?Please advice. Really URGENTLY need help on this.
Thanks in advance~
Elisha 
|
|
3Lish@
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 15 Sep 2009 at 6:26am |
|
totext({dateTimeField}, "MM/dd/yyyy HH:mm") found in CR help file.
|
IP Logged |
|
Elisha83
Groupie
Joined: 19 Feb 2008
Location: Malaysia
Online Status: Offline
Posts: 62
|

Posted: 16 Sep 2009 at 2:08am |
Thanks a lot lockwelle~ I manage to settle the report already. Really appreciate your help.
Thanks to Jyothi also for giving me some clue on how to do it. 
Have a nice day~
Elisha
|
|
3Lish@
|
IP Logged |
|
|
|