We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Format DateDiff

When I use formulas:

DateDiff(\"d\",\"2016 10 20 00:00:00\",\"2015 10 22 00:00:00\", 1 , 1) don't evalue correctly.


return #ERROR


Is format right ??



Hi Jose,


Thank you for writing to Aspose Support team.

Could you please share if the same works fine with MSP at your end? Please share a sample project file with us that we can use for comparison of the same at our end. We’ll look into this for assisting you further.

Hi,


It is a sample code in console app demo.

public class Program
{
static void Main(string[] args)
{
Project project = CreateTestProjectWithCustomField();
var task = project.RootTask.Children.GetById(1);

//DateAdd
project.ExtendedAttributes[0].Formula = “DateAdd(“d”,21,“2016 01 04”)”;
Console.WriteLine(task.ExtendedAttributes[0].Value);

//DateDiff
project.ExtendedAttributes[0].Formula = “DateDiff(“d”,“2016 10 20 00:00:00”,“2015 10 22 00:00:00”)”;
Console.WriteLine(task.ExtendedAttributes[0].Value);

//DatePart
project.ExtendedAttributes[0].Formula = “DatePart( “D”, “2015 03 19 00:00:00”,1 ,1)”;
Console.WriteLine(task.ExtendedAttributes[0].Value);

Console.ReadKey();
}

static Project CreateTestProjectWithCustomField()
{
Project project = new Project();
ExtendedAttributeDefinition attr = new ExtendedAttributeDefinition();
attr.FieldId = ExtendedAttributeTask.Text1.ToString(“D”);
attr.Alias = “demo”;
project.ExtendedAttributes.Add(attr);

var task = project.RootTask.Children.Add(“Task”);

ExtendedAttribute a = attr.CreateExtendedAttribute();
task.ExtendedAttributes.Add(a);
return project;
}
}



When I use the functions
  1. ProjDateAdd( date, duration, calendar )
  2. ProjDateConv( expression, dateformat )
  3. ProjDateDiff( date1, date2, calendar )
  4. ProjDateSub( date, duration, calendar )
I obtain rigth result but with the sample code It return #ERROR as result.


Thanks


Hi Jose,

Thank you for providing more details.

This issue is re-produced and logged under Id: TASKSNET-1684 for further investigation by the product team. You will be automatically notified once any update is received in this regard.

The issues you have found earlier (filed as TASKSNET-1684) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.