Java SQL Time From toTime(int value)

Here you can find the source of toTime(int value)

Description

to Time

License

Open Source License

Declaration

public static java.sql.Time toTime(int value) 

Method Source Code

//package com.java2s;
/**//from  ww w.  ja v a2s. co m
 * Project: ${puma-server.aid}
 * 
 * File Created at 2012-6-11 $Id$
 * 
 * Copyright 2010 dianping.com. All rights reserved.
 * 
 * This software is the confidential and proprietary information of Dianping
 * Company. ("Confidential Information"). You shall not disclose such
 * Confidential Information and shall use it only in accordance with the terms
 * of the license agreement you entered into with dianping.com.
 */

import java.util.Calendar;

public class Main {
    public static java.sql.Time toTime(int value) {
        int s = value % 100;
        if (value <= 1) {
            s = 1;
        }
        value /= 100;
        int m = value % 100;
        int h = value / 100;
        Calendar c = Calendar.getInstance();
        c.set(70, 0, 1, h, m, s);
        return new java.sql.Time(c.getTimeInMillis());
    }
}

Related

  1. toSQLTime(final LocalTime lt)
  2. toSqlTime(long date)
  3. toTime(Date value)
  4. toTime(final Date date)
  5. toTime(final Object value)
  6. toTime(java.util.GregorianCalendar cal)
  7. toTime(LocalTime localTime)
  8. toTime(LocalTime localTime)
  9. toTime(Object object, Object oDefault)