本文整理了Java中org.eigenbase.util14.ZonelessTime
类的一些代码示例,展示了ZonelessTime
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonelessTime
类的具体详情如下:
包路径:org.eigenbase.util14.ZonelessTime
类名称:ZonelessTime
[英]ZonelessTime is a time value without a time zone.
[中]ZonelessTime是一个没有时区的时间值。
代码示例来源:origin: org.apache.optiq/optiq-core
/**
* Converts this literal to a {@link ZonelessTime} object.
*/
protected ZonelessTime getTime() {
ZonelessTime zt = new ZonelessTime();
zt.setZonelessTime(getCal().getTimeInMillis());
return zt;
}
代码示例来源:origin: org.apache.optiq/optiq-core
/**
* Parses a string as a ZonelessTime.
*
* @param s a string representing a time in ISO format, i.e. according to
* the {@link SimpleDateFormat} string "HH:mm:ss"
* @return the parsed time, or null if parsing failed
*/
public static ZonelessTime parse(String s) {
return parse(s, DateTimeUtil.TIME_FORMAT_STRING);
}
代码示例来源:origin: org.apache.optiq/optiq-core
/**
* Formats this ZonelessTime via a SimpleDateFormat
*
* @param format format string, as required by SimpleDateFormat
* @return the formatted time string
*/
public String toString(String format) {
DateFormat formatter = getFormatter(format);
Time jdbcTime = getTempTime(getTime());
return formatter.format(jdbcTime);
}
代码示例来源:origin: org.apache.optiq/optiq-core
/**
* Converts this ZonelessTime to a java.sql.Time and formats it via the
* {@link java.sql.Time#toString() toString()} method of that class.
*
* @return the formatted time string
*/
public String toString() {
Time jdbcTime = getTempTime(getJdbcTime(DateTimeUtil.DEFAULT_ZONE));
return jdbcTime.toString();
}
代码示例来源:origin: org.apache.optiq/optiq-core
/**
* Override ZonelessDatetime.
*
* <p>NOTE: the returned timestamp is based on the current date of the
* specified time zone, rather than the context variable for current_date,
* as specified by the SQL standard.
*/
public long getJdbcTimestamp(TimeZone zone) {
Calendar cal = getCalendar(DateTimeUtil.GMT_ZONE);
cal.setTimeInMillis(getTime());
int hour = cal.get(Calendar.HOUR_OF_DAY);
int minute = cal.get(Calendar.MINUTE);
int second = cal.get(Calendar.SECOND);
int millis = cal.get(Calendar.MILLISECOND);
cal.setTimeZone(zone);
cal.setTimeInMillis(System.currentTimeMillis());
cal.set(Calendar.HOUR_OF_DAY, hour);
cal.set(Calendar.MINUTE, minute);
cal.set(Calendar.SECOND, second);
cal.set(Calendar.MILLISECOND, millis);
return cal.getTimeInMillis();
}
代码示例来源:origin: cascading/lingual-core
protected ZonelessTime createInstance()
{
return new ZonelessTime();
}
代码示例来源:origin: net.hydromatic/optiq
public void setZonedTime(long value, TimeZone zone)
{
super.setZonedTime(value, zone);
clearDate();
}
代码示例来源:origin: net.hydromatic/optiq
public Object toJdbcObject()
{
return new Time(getJdbcTime(DateTimeUtil.defaultZone));
}
代码示例来源:origin: net.hydromatic/optiq
/**
* Returns e.g. '03:05:67.456'.
*/
public String toFormattedString()
{
String result = getTime().toString(formatString);
final Calendar cal = getCal();
if (precision > 0) {
assert (precision <= 3);
// get the millisecond count. millisecond => at most 3 digits.
String digits = Long.toString(cal.getTimeInMillis());
result =
result + "."
+ digits.substring(
digits.length() - 3,
digits.length() - 3 + precision);
} else {
assert (0 == cal.get(Calendar.MILLISECOND));
}
return result;
}
}
代码示例来源:origin: net.hydromatic/optiq
/**
* Converts this ZonelessTime to a java.sql.Time and formats it via the
* {@link java.sql.Time#toString() toString()} method of that class.
*
* @return the formatted time string
*/
public String toString()
{
Time jdbcTime = getTempTime(getJdbcTime(DateTimeUtil.defaultZone));
return jdbcTime.toString();
}
代码示例来源:origin: net.hydromatic/optiq
/**
* Override ZonelessDatetime.
*
* <p>NOTE: the returned timestamp is based on the current date of the
* specified time zone, rather than the context variable for current_date,
* as specified by the SQL standard.
*/
public long getJdbcTimestamp(TimeZone zone)
{
Calendar cal = getCalendar(DateTimeUtil.gmtZone);
cal.setTimeInMillis(getTime());
int hour = cal.get(Calendar.HOUR_OF_DAY);
int minute = cal.get(Calendar.MINUTE);
int second = cal.get(Calendar.SECOND);
int millis = cal.get(Calendar.MILLISECOND);
cal.setTimeZone(zone);
cal.setTimeInMillis(System.currentTimeMillis());
cal.set(Calendar.HOUR_OF_DAY, hour);
cal.set(Calendar.MINUTE, minute);
cal.set(Calendar.SECOND, second);
cal.set(Calendar.MILLISECOND, millis);
return cal.getTimeInMillis();
}
代码示例来源:origin: org.apache.optiq/optiq-core
break;
case TIME:
printDatetime(pw, new ZonelessTime(), value);
break;
case TIMESTAMP:
代码示例来源:origin: org.apache.optiq/optiq-core
public void setZonelessTime(long value) {
super.setZonelessTime(value);
clearDate();
}
代码示例来源:origin: org.apache.optiq/optiq-core
public Object toJdbcObject() {
return new Time(getJdbcTime(DateTimeUtil.DEFAULT_ZONE));
}
代码示例来源:origin: org.apache.optiq/optiq-core
/**
* Returns e.g. '03:05:67.456'.
*/
public String toFormattedString() {
String result = getTime().toString(formatString);
final Calendar cal = getCal();
if (precision > 0) {
assert precision <= 3;
// get the millisecond count. millisecond => at most 3 digits.
String digits = Long.toString(cal.getTimeInMillis());
result =
result + "."
+ digits.substring(digits.length() - 3,
digits.length() - 3 + precision);
} else {
assert 0 == cal.get(Calendar.MILLISECOND);
}
return result;
}
}
代码示例来源:origin: net.hydromatic/optiq
/**
* Converts this literal to a {@link ZonelessTime} object.
*/
protected ZonelessTime getTime()
{
ZonelessTime zt = new ZonelessTime();
zt.setZonelessTime(getCal().getTimeInMillis());
return zt;
}
代码示例来源:origin: net.hydromatic/optiq
/**
* Formats this ZonelessTime via a SimpleDateFormat
*
* @param format format string, as required by SimpleDateFormat
*
* @return the formatted time string
*/
public String toString(String format)
{
DateFormat formatter = getFormatter(format);
Time jdbcTime = getTempTime(getTime());
return formatter.format(jdbcTime);
}
代码示例来源:origin: net.hydromatic/optiq
/**
* Parses a string as a ZonelessTime.
*
* @param s a string representing a time in ISO format, i.e. according to
* the {@link SimpleDateFormat} string "HH:mm:ss"
*
* @return the parsed time, or null if parsing failed
*/
public static ZonelessTime parse(String s)
{
return parse(s, DateTimeUtil.TimeFormatStr);
}
代码示例来源:origin: net.hydromatic/optiq
break;
case TIME:
printDatetime(pw, new ZonelessTime(), value);
break;
case TIMESTAMP:
代码示例来源:origin: net.hydromatic/optiq
public void setZonelessTime(long value)
{
super.setZonelessTime(value);
clearDate();
}
内容来源于网络,如有侵权,请联系作者删除!