on 05-22-2015 7:47 AM
Hello,
How can we achieve functionality of adding months like if we two fields are of type date and we want to add them up.
Eg: var month1 = this.date.getmonth();
var month2 = this.date2.getmonth();
so if month1 = 1 , month 2= 3;
total month = month1 + month2; i.e. 4 not 13... as this feild becomes date type i am getting 13 as a result.
If anyone can provide inputs on this.
Thanks and Regards,
Stuti
Hi Stuti,
Try this.
totalMonth=Numeric.ParseFromString(month1)+Numeric.ParseFromString(month2);
Regards,
Fred
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Stuti,
Hmm. Back to date?
this.todate=Date.Create(this.date1.GetDay(),this.totalMonth,this.GetYear());
But there , you need to check if this.totalMonth is greater than or equal 12, if it is , you have to add 1 to the year and you have to change your month back.
Is that what you want?
If not, can you please let me know your use case more in detail?
Or you can find it by yourself about Data Types and Reuse Libraries in Studio Documentation.
The following is for Date.
7.2.5.1.5 Date (Reuse Library)
Regards,
Fred.
Hi Stuti,
You can use AddDuration method. Something like this:
dateNow = Date.ParseFromString("20100215");
result = dateNow.AddDuration(ABSL:Duration.ParseFromString("P1M"));
this will result in date 2010-03-16.
The duration is represented as ISO 8601 format. For example P3D would be 3 days.
Regards,
Paul
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.