Hi Sridevi,
You should localize the attribute.
or else
use this java action just pass the created date of the obj1 and return the date in java action.
// This file was generated by Mendix Studio Pro.
//
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
// Special characters, e.g., é, ö, à, etc. are supported in comments.
package myfirstmodule.actions;
import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;
import java.math.BigDecimal;
import java.util.TimeZone;
public class Java_action extends CustomJavaAction<java.util.Date>
{
private final java.util.Date date;
public Java_action(
IContext context,
java.util.Date _date
)
{
super(context);
this.date = _date;
}
@java.lang.Override
public java.util.Date executeAction() throws Exception
{
// BEGIN USER CODE
TimeZone userTimeZone = getContext().getSession().getTimeZone();
int offsetMillis = userTimeZone.getOffset(System.currentTimeMillis());
BigDecimal offsetDecimal = new BigDecimal(offsetMillis);
BigDecimal divisor = new BigDecimal(3600000);
BigDecimal offsetHours = offsetDecimal.divide(divisor, 6, BigDecimal.ROUND_HALF_UP);
// Add offsetHours (in milliseconds) to the input date
long offsetMillisFromHours = offsetHours.multiply(new BigDecimal(3600000)).longValue();
long newTime = this.date.getTime() + offsetMillisFromHours;
return new java.util.Date(newTime);
// END USER CODE
}
/**
* Returns a string representation of this action
* @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
{
return "Java_action";
}
// BEGIN EXTRA CODE
// END EXTRA CODE
}