本文整理汇总了Java中org.apache.axis2.databinding.utils.ConverterUtil.convertToDate方法的典型用法代码示例。如果您正苦于以下问题:Java ConverterUtil.convertToDate方法的具体用法?Java ConverterUtil.convertToDate怎么用?Java ConverterUtil.convertToDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.databinding.utils.ConverterUtil
的用法示例。
在下文中一共展示了ConverterUtil.convertToDate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDate
import org.apache.axis2.databinding.utils.ConverterUtil; //导入方法依赖的package包/类
/**
* Create a Date object from the given date string.
*/
public static Date getDate(String value) throws DataServiceFault {
/* if something goes wrong with converting the value to a date,
* try with dateTime and get the date out it, this is because,
* some service clients send a full date-time string for a date */
try {
java.util.Date date = ConverterUtil.convertToDate(value);
if (null == date) {
throw new DataServiceFault("Empty string or null value was found as date.");
} else {
return new Date(date.getTime());
}
} catch (Exception e) {
java.util.Calendar calendarDate = ConverterUtil.convertToDateTime(value);
if (null == calendarDate) {
throw new DataServiceFault("Empty string or null value was found as date.");
} else {
return new Date(calendarDate.getTimeInMillis());
}
}
}
示例2: testPopulate
import org.apache.axis2.databinding.utils.ConverterUtil; //导入方法依赖的package包/类
public void testPopulate() throws Exception {
Date date = null;
for (int i = 0; i < values.length; i++) {
date = ConverterUtil.convertToDate(values[i]);
checkValue(xmlString[i],ConverterUtil.convertToString(date));
}
}
示例3: makeDate
import org.apache.axis2.databinding.utils.ConverterUtil; //导入方法依赖的package包/类
public static Object makeDate(String source) {
return ConverterUtil.convertToDate(source);
}
示例4: convertToDate
import org.apache.axis2.databinding.utils.ConverterUtil; //导入方法依赖的package包/类
public Date convertToDate(String s) {
return ConverterUtil.convertToDate(s);
}