Java Utililty Methods SQL Time

List of utility methods to do SQL Time

Description

The list of methods to do SQL Time are organized into topic(s).

Method

voidresetNetworkTimeout(Connection rawConnection, Executor executor, int oldTimeout)
reset Network Timeout
if (oldTimeout >= 0)
    rawConnection.setNetworkTimeout(executor, oldTimeout);
ObjectroundDatetimeValue(Object value)
Utility method for a datetime value
if (value == null)
    return null;
Timestamp ts = value instanceof Timestamp ? (Timestamp) value
        : new Timestamp(((Calendar) value).getTimeInMillis());
int millis = ts.getNanos() / 1000000;
int lastDigit = (int) (millis % 10);
switch (lastDigit) {
case 1:
...
ObjectroundSmallDateTimeValue(Object value)
Utility method for a datetime value
if (value == null) {
    return null;
Calendar cal;
java.sql.Timestamp ts = null;
int nanos = -1;
if (value instanceof Calendar) {
    cal = (Calendar) value;
...
booleansaveGameScores(String gameName, String player1, String player2, String player3, String player4, short score1, short score2, short score3, short score4, java.util.Date startTime)
DOCUMENT ME!
if (checkConnection()) {
    try {
        saveGameCommand.setString(1, gameName);
        saveGameCommand.setString(2, player1);
        saveGameCommand.setString(3, player2);
        saveGameCommand.setString(4, player3);
        saveGameCommand.setString(5, player4);
        saveGameCommand.setShort(6, score1);
...
Stringserialize(LocalDateTime date)
serialize
return date.format(ISO_FORMAT);
StringserializeSqlTime(Time time)
Serialize time to standard text.
StringBuffer buff = new StringBuffer(12);
serializeTime((int) time.getTime(), buff);
return buff.toString();
voidsetTime(PreparedStatement statement, int index, Date value)
Sets a SQL parameter of type time using a prepared SQL statement, an index and a value.
if (statement != null) {
    if (value == null) {
        statement.setNull(index, Types.TIME);
    } else {
        statement.setTime(index, new java.sql.Time(value.getTime()));
java.sql.TimestampsqlDateTimeAdd(java.util.Date date, long milliseconds)
sql Date Time Add
long ct;
if (date == null) {
    ct = System.currentTimeMillis();
} else {
    ct = date.getTime();
return new java.sql.Timestamp(ct + milliseconds);
java.sql.TimesqlTime()
sql Time
return sqlTime(null);
Timestampstr2dateTime(String handedate)
strdate Time
Timestamp time = null;
try {
    java.util.Date date = str2utilDate(handedate);
    java.util.Date now = new java.util.Date();
    date.setHours(now.getHours());
    date.setMinutes(now.getMinutes());
    date.setSeconds(now.getSeconds());
    time = new Timestamp(date.getTime());
...