user2365965
user2365965

Reputation: 11

String to date + treatment + date to string

I am working with WODM rule designer V7.5, my XOM is an XSD

I should compare the date of a transaction with the current date, so if a client does a transaction, the expiration date of his account should be incremented by one year !

Dates in my XOM are Strings, so in the BOM TO XOM MAPPING part of my BOM I created 2 methods :

The rule is the following :

definitions 
set 'variable1' to calendar NewDate (the transaction date of transaction) ; 
if 
    the transaction date of transaction is today on the calendar 
    then 
        set the expiration date of account to variable1 ; 

I enter transaction date like this : "2013-05-13", I was expecting : "2014-05-13" in the expiration date variable, but I get this 0181-10-05

Anyone can help ? Thanks.

Upvotes: 1

Views: 403

Answers (1)

Harish Bhat
Harish Bhat

Reputation: 39

Your way of splitting the string is wrong as the year is entered as the 1st field and you are trying to obtain the date from this field, that is the order of the fields matter.

Essentially, your code should contain (notice the indexes):

int month=Integer.parseInt(splitdata[1]); 
int day=Integer.parseInt(splitdata[2]); 
int year=Integer.parseInt(splitdata[0]);

Upvotes: 2

Related Questions