热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

javax.xml.bind.DatatypeConverter.printTime()方法的使用及代码示例

本文整理了Java中javax.xml.bind.DatatypeConverter.printTime()方法的一些代码示例,展示了DatatypeCon

本文整理了Java中javax.xml.bind.DatatypeConverter.printTime()方法的一些代码示例,展示了DatatypeConverter.printTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DatatypeConverter.printTime()方法的具体详情如下:
包路径:javax.xml.bind.DatatypeConverter
类名称:DatatypeConverter
方法名:printTime

DatatypeConverter.printTime介绍

[英]Converts a Calendar value into a string.
[中]将日历值转换为字符串。

代码示例

代码示例来源:origin: mulesoft/mule

@Test
public void testToString() {
assertThat(now.getTime().withTimeZone("UTC").toString().substring(0, 8),
is(DatatypeConverter.printTime(Calendar.getInstance(TimeZone.getTimeZone("UTC"))).substring(0, 8)));
}

代码示例来源:origin: hibernate/hibernate-ogm

@Override
public String toString(Calendar value) {
return DatatypeConverter.printTime( value );
}
},

代码示例来源:origin: org.mule/mule-core

@Override
public String toString()
{
return DatatypeConverter.printTime(calendar);
}

代码示例来源:origin: org.gatein.wsrp/wsrp-common

@Override
public String printToXML(Serializable value)
{
return printTime((Calendar)value);
}

代码示例来源:origin: org.geotools/gt2-xml-xsd

/**
*
*
*
* @generated modifiable
*/
public String encode(Object object, String value) {
Calendar calendar = (Calendar) object;
return DatatypeConverter.printTime(calendar);
}
}

代码示例来源:origin: org.jvnet.hyperjaxb3/hyperjaxb3-ejb-runtime

@Override
public String marshal(Calendar time) throws Exception {
if (time == null) {
return null;
} else {
return DatatypeConverter.printTime(time);
}
}

代码示例来源:origin: org.geotools/gt2-xml-core

/**
*
*
*
* @generated modifiable
*/
public String encode(Object object, String value) {
Calendar calendar = (Calendar) object;
return DatatypeConverter.printTime(calendar);
}
}

代码示例来源:origin: org.geotools.xsd/gt-core

/**
*
*
*
* @generated modifiable
*/
public String encode(Object object, String value) {
Calendar calendar = (Calendar) object;
return DatatypeConverter.printTime(calendar);
}
}

代码示例来源:origin: marklogic/java-client-api

@Override
public String toString() {
return DatatypeConverter.printTime(value);
}
}

代码示例来源:origin: highsource/hyperjaxb3

@Override
public String marshal(Calendar time) throws Exception {
if (time == null) {
return null;
} else {
return DatatypeConverter.printTime(time);
}
}

代码示例来源:origin: org.mule.runtime/mule-core

@Override
public String toString() {
return DatatypeConverter.printTime(calendar);
}

代码示例来源:origin: org.apache.cxf.xjc-utils/cxf-xjc-runtime

public static String printTime(Date dt) {
if (dt == null) {
return null;
}
Calendar c = Calendar.getInstance();
c.setTime(dt);
return DatatypeConverter.printTime(c);
}

代码示例来源:origin: hibernate/hibernate-ogm

@Override
public String toString(Date value) {
Calendar calendar = Calendar.getInstance( TimeZone.getTimeZone( "UTC" ) );
calendar.setTime( value );
return DatatypeConverter.printTime( calendar );
}
},

代码示例来源:origin: org.jasig.portlet.utils/portlet-ws-util

public static String printTime(LocalTime localTime) {
final DateTime dateTime = localTime.toDateTimeToday(DateTimeZone.UTC);
final GregorianCalendar cal = dateTime.toGregorianCalendar();
return DatatypeConverter.printTime(cal);
}

代码示例来源:origin: marklogic/java-client-api

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();
}
@Override

代码示例来源:origin: org.mule.runtime/mule-core-tests

@Test
public void testToString() {
assertThat(now.getTime().withTimeZone("UTC").toString().substring(0, 8),
is(DatatypeConverter.printTime(Calendar.getInstance(TimeZone.getTimeZone("UTC"))).substring(0, 8)));
}

代码示例来源:origin: com.marklogic/client-api-java

static public void convertFromJava(Calendar value, ValueProcessor processor) {
if (value == null) {
processor.process(null, null, null);
return;
}
if (!value.isSet(Calendar.DAY_OF_MONTH))
processor.process(
value,
"xs:time",
DatatypeConverter.printTime(value)
);
else if (value.isSet(Calendar.HOUR_OF_DAY))
processor.process(
value,
"xs:dateTime",
DatatypeConverter.printDateTime(value)
);
else
processor.process(
value,
"xs:date",
DatatypeConverter.printDate(value)
);
}
static public void convertFromJava(Double value, ValueProcessor processor) {

代码示例来源:origin: marklogic/java-client-api

static public void convertFromJava(Calendar value, ValueProcessor processor) {
if (value == null) {
processor.process(null, null, null);
return;
}
if (!value.isSet(Calendar.DAY_OF_MONTH))
processor.process(
value,
"xs:time",
DatatypeConverter.printTime(value)
);
else if (value.isSet(Calendar.HOUR_OF_DAY))
processor.process(
value,
"xs:dateTime",
DatatypeConverter.printDateTime(value)
);
else
processor.process(
value,
"xs:date",
DatatypeConverter.printDate(value)
);
}
static public void convertFromJava(Double value, ValueProcessor processor) {

推荐阅读
author-avatar
黑衬衫1994
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有