Question

DateTime Method - Parameter

Hello, 

How could you set up a parameter in the Business Process designer to display: 

- the 15th Day of the Current Month  (Output = Date) 

- the 15th Day of the Next Month   (Output = Date)

I ve tried a few ways but had not luck. Help would be much appreciated! 

 

 

Like 0

Like

7 comments

Hello,

It depends on the purpose of the designed business process. If you want to filter something you should add condition like on the screenshot http://prntscr.com/jxfbnp and specify exact date. For example 15.06.2018. And you will get the result for this day. The same one is for the next mount. If you want to build formula you should specify condition like on the screenshot http://prntscr.com/jxfc6b. If it hasn't helped please describe the idea of the business process that you are creating.

Oscar Dylan,

Oscar Dylan,

Hello Oscar, 

Thank you for your reply, but I need the parameter to have a formula to calculate those dates rather than I specify it: 

-Process Example: ReadData -> Lead Date (22/03/2018) 

Parameter 1:   DateTime.CurrentMonth(15th Day)  - 15/03/2018

Parameter 2:   DateTime.NextMonth(15th Day)       - 15/04/2018

Does this make sense? Thank you

Thanos,

Have you tried something like this ?

First date: DateTime(DateTime.Now.Year, DateTime.Now.Month, 15)

Second date: First date.AddMonths(1)

Jean I have but I get the following error:

Formula value error: Parameter "DateDateTimeUtilities" not found 

I don't really know if you can use it in a formula, but what about a script task ?

DateTime date = Get<DateTime>("LeadDate");
 
DateTime firstDate = new DateTime(date.Year, date.Month, 15);
DateTime secondDate = firstDate.AddMonths(1);
 
Set("FirstDateParameter", firstDate);
Set("SecondDateParameter", secondDate);
 
return true;

with using 'System'

Jean Michou,

Thank you Jean, really appreciate it, I tried but I dont think I know how to get rid of the errors on the script task... Asked support for help in the meantime! 

The following formulas will work

DateTime.Now.AddDays(15 - DateTime.Now.Day).AddHours(12-DateTime.Now.Hour)



DateTime.Now.AddMonths(1).AddDays(15 - DateTime.Now.Day).AddHours(12 - DateTime.Now.Hour)

Show all comments