Java SQL Date From toDate(int value)

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

Description

to Date

License

Open Source License

Declaration

public static java.sql.Date toDate(int value) 

Method Source Code

//package com.java2s;
/**//w w w.  j  a  v  a  2 s.c  o  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.Date toDate(int value) {
        int d = value % 32;
        value >>>= 5;
        int m = value % 16;
        int y = value >> 4;
        Calendar cal = Calendar.getInstance();
        cal.clear();
        cal.set(y, m - 1, d);
        return new java.sql.Date(cal.getTimeInMillis());
    }
}

Related

  1. getDateTime()
  2. getDateTime()
  3. getDateTime(final int year, final int month, final int day, final int hour, final int minute, final int second)
  4. getDateTime(Object value)
  5. toDate(Calendar cal)
  6. toDate(java.sql.Date sqlDate)
  7. toDate(java.util.Date date)
  8. toDate(Object date)
  9. toDate(Object o)