Java Code Examples for javax.xml.bind.DatatypeConverter#printDate()
The following examples show how to use
javax.xml.bind.DatatypeConverter#printDate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CloverDateConvertor.java From CloverETL-Engine with GNU Lesser General Public License v2.1 | 6 votes |
public static String printDateToXsdDate(Date value) throws DataConversionException { String result = null; String valueType = Date.class.getName(); try { GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(value); result = DatatypeConverter.printDate(calendar); } catch(Exception e) { if (value != null) valueType = value.getClass().getName(); logger.fatal("Unable to print "+valueType+" to xsd:date.",e); throw new DataConversionException("Unable to print "+valueType+" to xsd:date.", e); } return result; }
Example 2
Source File: StructuredQueryBuilder.java From java-client-api with Apache License 2.0 | 6 votes |
String formatValue(Object value, String type) { if ( value == null ) { return "null"; } Class<?> valClass = value.getClass(); if ( String.class.isAssignableFrom(valClass) ) { return (String) value; } else if ( type != null && ( type.endsWith("date") || type.endsWith("dateTime") || type.endsWith("time") ) && ( Date.class.isAssignableFrom(valClass) || Calendar.class.isAssignableFrom(valClass) ) ) { if ( Date.class.isAssignableFrom(valClass) ) { Calendar cal = Calendar.getInstance(); cal.setTime((Date) value); value = cal; } if ( type.endsWith("date") ) { return DatatypeConverter.printDate((Calendar) value); } else if ( type.endsWith("dateTime") ) { return DatatypeConverter.printDateTime((Calendar) value); } else if ( type.endsWith("time") ) { return DatatypeConverter.printTime((Calendar) value); } } return value.toString(); }
Example 3
Source File: XmlDateTypeAdapter.java From cia with Apache License 2.0 | 5 votes |
public String marshal(final Date dt) { if (dt == null) { return null; } final Calendar c = Calendar.getInstance(); c.setTime(dt); return DatatypeConverter.printDate(c); }
Example 4
Source File: DataTypeAdapterCXF.java From govpay with GNU General Public License v3.0 | 5 votes |
public static String printDate(Date dt) { if (dt == null) { return null; } Calendar c = Calendar.getInstance(); c.setTime(dt); return DatatypeConverter.printDate(c); }
Example 5
Source File: DataTypeAdapterCXF.java From govpay with GNU General Public License v3.0 | 5 votes |
public static String printDate(Date dt) { if (dt == null) { return null; } Calendar c = Calendar.getInstance(); c.setTime(dt); return DatatypeConverter.printDate(c); }
Example 6
Source File: DateUtils.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
public static String printDate(DateTime dateTime) { return dateTime == null ? null : DatatypeConverter.printDate(convert(dateTime)); }
Example 7
Source File: DateUtils.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
public static String printDate(DateTime dateTime) { return dateTime == null ? null : DatatypeConverter.printDate(convert(dateTime)); }
Example 8
Source File: DateUtils.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
public static String printDate(DateTime dateTime) { return dateTime == null ? null : DatatypeConverter.printDate(convert(dateTime)); }
Example 9
Source File: DateUtils.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
public static String printDate(DateTime dateTime) { return dateTime == null ? null : DatatypeConverter.printDate(convert(dateTime)); }
Example 10
Source File: DateUtils.java From freehealth-connector with GNU Affero General Public License v3.0 | 4 votes |
public static String printDate(DateTime dateTime) { return dateTime == null ? null : DatatypeConverter.printDate(convert(dateTime)); }
Example 11
Source File: XsValueImpl.java From java-client-api with Apache License 2.0 | 4 votes |
@Override public String toString() { return DatatypeConverter.printDate(value); }
Example 12
Source File: DateAdapter.java From xero-java-client with Apache License 2.0 | 4 votes |
public static String printDateTime(Date dt) { Calendar cal = new GregorianCalendar(); cal.setTime(dt); return DatatypeConverter.printDate(cal); }
Example 13
Source File: HiveWritableValueWriter.java From elasticsearch-hadoop with Apache License 2.0 | 4 votes |
static String toES(Object dateWritable) { DateWritable dw = (DateWritable) dateWritable; Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(dw.get().getTime()); return DatatypeConverter.printDate(cal); }