大家好!我有一个休息的get方法,结果存储在这样的东西中:
@XmlRootElement(name = "FooDTO")
public class Foo {
@XmlElement(nillable = true)
private String approvedDate;
private static final DateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat(
"dd.MM.yyyy");
public Date getApprovedDate() {
try {
return StringUtils.isBlank(approvedDate) ? null
: DEFAULT_DATE_FORMAT.parse(approvedDate);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
public void setApprovedDate(Date approvedDate) {
this.approvedDate = approvedDate == null ? "" : DEFAULT_DATE_FORMAT
.format(approvedDate);
}
}
它在Glassfish服务器中工作,并且我以dd.MM.yyyy格式将StringDate批准为String。但是,在Payara中,字符串已格式化为yyyy-MM-ddTHH:mm:ssZ [Timezone]。如何调整此值,以使字符串不会被“解释”为DateTime?谢谢!
答案 0 :(得分:1)
正如我所看到的,您有一个Uri UrlCrm = new Uri(CRMUrl);
String UserLogin = Domain + "\\" + Username;
String password = Password;
ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential.UserName = UserLogin;
credentials.Windows.ClientCredential.Password = password;
OrganizationServiceProxy serverProxy = new OrganizationServiceProxy(UrlCrm, null, credentials, null);
IOrganizationService service;
service = (IOrganizationService)serverProxy;
QueryExpression query = new QueryExpression("contact");
string[] cols = { "contactid", "emailaddress1" };
query.Criteria = new FilterExpression();
query.Criteria.AddCondition("emailaddress1", ConditionOperator.Equal, "Divakar.Ragupathy8@sqs.com");
query.ColumnSet = new ColumnSet(cols);
var contact = service.RetrieveMultiple(query);
//Entity contact = new Entity("contact");
Guid contactId = (Guid)contact.Attributes["contactid"];
GuidKey = contactId.ToString();
字段,它是私有字段,因此,封送/取消封送过程通过get / set访问此字段,在这种情况下,它将以approvedDate
方法上的日期类型返回
尝试:
getApprovedDate