[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

calculating time - URGENT

Hema

1/9/2006 12:06:00 PM

Hi,

how do i calculate the time in the following case:

i have a real control called duration and time control called starttime. if
i will give 0.30 in duration field and 04:01:00 in starttime field, then i
have to add 30 minutes with 04.01 hrs and result should be 04:31:00. but, the
result is 04:19:00.

my code is
this.StartTime+str2time(time2str(this.Duration*3600,1,1))

the above code works only when entering integer values / hrs (ie 04). when i
give minutes or real value, the above code is not working.

tell me the solution how do i calculate the exact time?

regs,
Hema. S
2 Answers

mortenm

1/9/2006 1:40:00 PM

0

Hi Hema,

I think your problem is the value in your real control. 0,30 is not 30
minutes, it is 0,30 of one hour, that is 18 minutes. If you were to enter
0,50, that is half an hour, you would get 30 minutes. If you want 0,30 to be
30 minutes you have to do a calculation or ask the user to enter the time in
minutes. I think most users would prefer to enter 30 minutes as 0,5 hours.

Regards,
Morten Mile

"Hema" wrote:

> Hi,
>
> how do i calculate the time in the following case:
>
> i have a real control called duration and time control called starttime. if
> i will give 0.30 in duration field and 04:01:00 in starttime field, then i
> have to add 30 minutes with 04.01 hrs and result should be 04:31:00. but, the
> result is 04:19:00.
>
> my code is
> this.StartTime+str2time(time2str(this.Duration*3600,1,1))
>
> the above code works only when entering integer values / hrs (ie 04). when i
> give minutes or real value, the above code is not working.
>
> tell me the solution how do i calculate the exact time?
>
> regs,
> Hema. S

Hema

1/11/2006 4:13:00 AM

0

Hi,

Thank you for your suggesion.

regs,
Hema. S

"mortenm" wrote:

> Hi Hema,
>
> I think your problem is the value in your real control. 0,30 is not 30
> minutes, it is 0,30 of one hour, that is 18 minutes. If you were to enter
> 0,50, that is half an hour, you would get 30 minutes. If you want 0,30 to be
> 30 minutes you have to do a calculation or ask the user to enter the time in
> minutes. I think most users would prefer to enter 30 minutes as 0,5 hours.
>
> Regards,
> Morten Mile
>
> "Hema" wrote:
>
> > Hi,
> >
> > how do i calculate the time in the following case:
> >
> > i have a real control called duration and time control called starttime. if
> > i will give 0.30 in duration field and 04:01:00 in starttime field, then i
> > have to add 30 minutes with 04.01 hrs and result should be 04:31:00. but, the
> > result is 04:19:00.
> >
> > my code is
> > this.StartTime+str2time(time2str(this.Duration*3600,1,1))
> >
> > the above code works only when entering integer values / hrs (ie 04). when i
> > give minutes or real value, the above code is not working.
> >
> > tell me the solution how do i calculate the exact time?
> >
> > regs,
> > Hema. S