Java Code Examples for javax.xml.bind.DatatypeConverter#printDate()
The following examples show how to use
javax.xml.bind.DatatypeConverter#printDate() .
These examples are extracted from open source projects.
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 Project: CloverETL-Engine File: CloverDateConvertor.java License: 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 Project: java-client-api File: StructuredQueryBuilder.java License: 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 Project: cia File: XmlDateTypeAdapter.java License: 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 Project: govpay File: DataTypeAdapterCXF.java License: 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 Project: govpay File: DataTypeAdapterCXF.java License: 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 Project: freehealth-connector File: DateUtils.java License: 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 Project: freehealth-connector File: DateUtils.java License: 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 Project: freehealth-connector File: DateUtils.java License: 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 Project: freehealth-connector File: DateUtils.java License: 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 Project: freehealth-connector File: DateUtils.java License: 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 Project: java-client-api File: XsValueImpl.java License: Apache License 2.0 | 4 votes |
@Override public String toString() { return DatatypeConverter.printDate(value); }
Example 12
Source Project: xero-java-client File: DateAdapter.java License: 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 Project: elasticsearch-hadoop File: HiveWritableValueWriter.java License: 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); }