Wednesday, March 7, 2012

DateTime Addition Problem

Hi All,

My problem is I have a field called 'Production hours' in the report which is a decimal field. I need to add it to 'Scheduled Date' which is a date time field. I was using the DateAdd function in the formula. But if I have values like 0.50 for Production-hours, then the function does not work.
THe formula is as follows:

datetimevar x;
if not isnull({dpRptScheduleReport.prod_hrs}) then
(
x:=DateAdd('h', {dpRptScheduleReport.prod_hrs},{@.Schd_Start_Time});
if DayOfWeek(x)=7 then x:=DateAdd("d",2,x) else
if DayOfWeek(x)=1 then x:=DateAdd("d",1,x);
x;
)
else
{@.Schd_Start_Time};

Here dpRptScheduleReport is the Stored Proc. Can anybody help me please??

Thanks
Rashmi.Hi Rashmi

Try using this.

DateAdd('n',(.50*60) ,datetime('1-jan-2006'))

x:=DateAdd('n', {dpRptScheduleReport.prod_hrs}*60,{@.Schd_Start_Time});

Hope it helps..|||Hey thanks Raheem...It worked !!!!!!!

Rashmi

No comments:

Post a Comment