美文网首页
java.sql.Timestamp

java.sql.Timestamp

作者: 等你足够强了再说吧 | 来源:发表于2022-04-28 18:17 被阅读0次
/**
 * Constructs a <code>Timestamp</code> object
 * using a milliseconds time value. The
 * integral seconds are stored in the underlying date value; the
 * fractional seconds are stored in the <code>nanos</code> field of
 * the <code>Timestamp</code> object.
 *
 * @param time milliseconds since January 1, 1970, 00:00:00 GMT.
 *        A negative number is the number of milliseconds before
 *         January 1, 1970, 00:00:00 GMT.
 * @see java.util.Calendar
 */
public Timestamp(long time) {
    super((time/1000)*1000);
    nanos = (int)((time%1000) * 1000000);
    if (nanos < 0) {
        nanos = 1000000000 + nanos;
        super.setTime(((time/1000)-1)*1000);
    }
}

相关文章

网友评论

      本文标题:java.sql.Timestamp

      本文链接:https://www.haomeiwen.com/subject/ixvdyrtx.html