JAVA step to convert Julian date
Can some provide screen shot of Activity JAVA step used to convert Julian date to MM/DD/YYYY
Ex: 2019035 = 02/04/2019
-
Like (0)
-
Accepted Solution

To use the Parameter you should follow the below steps:
- Create a "Input" parameter in your activity of type String and INPUT.
- Replace your java code with below code,
String paramValue= (String) tools.getParameterPage().getParameterValue("Input");try{
java.text.DateFormat fmt1 = new java.text.SimpleDateFormat("yyyyDDD");
Date date = fmt1.parse(paramValue);
java.text.DateFormat fmt2 = new java.text.SimpleDateFormat("MM/dd/yyyy");
Output = fmt2.format(date);
}
catch(java.text.ParseException e){
oLog.info("Parsing error : " + e);
}
This way you can input the date value to your activity.

Hi Henry,
You can try to use the SimpleDateFormat class to get the calendar date format DD/mm/yyyy from the julian date format with the same code attached. Hope this will help you to achieve your requirement.
Regards,
Mahesh M

I am getting "delete tokens" error and "Invalid syntax"
See Attachment

Can you copy paste the below code in the Java step and try it,
String input = "2019035";
try{
java.text.DateFormat fmt1 = new java.text.SimpleDateFormat("yyyyDDD");
Date date = fmt1.parse(input);
java.text.DateFormat fmt2 = new java.text.SimpleDateFormat("MM/dd/yyyy");
Output = fmt2.format(date);
}
catch(java.text.ParseException e){
oLog.info("Parsing error : " + e);
}
Observation: In your code Output = fm2.format(date) is being referenced.

I was able to get it to work, thanks for your help.
But it seems to only work if I put the Julian Date numbers for ‘String Input’
If I try to pass a parameter it does not seem to take it.
Since the dates will change, how can I pass a value to ‘String Input’ instead of hardcode….
See Attachment
Accepted Solution

To use the Parameter you should follow the below steps:
- Create a "Input" parameter in your activity of type String and INPUT.
- Replace your java code with below code,
String paramValue= (String) tools.getParameterPage().getParameterValue("Input");try{
java.text.DateFormat fmt1 = new java.text.SimpleDateFormat("yyyyDDD");
Date date = fmt1.parse(paramValue);
java.text.DateFormat fmt2 = new java.text.SimpleDateFormat("MM/dd/yyyy");
Output = fmt2.format(date);
}
catch(java.text.ParseException e){
oLog.info("Parsing error : " + e);
}
This way you can input the date value to your activity.