Java SQL Date From convertTimeToHour(long time)

Here you can find the source of convertTimeToHour(long time)

Description

convert Time To Hour

License

Open Source License

Declaration

public static double convertTimeToHour(long time) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.time.LocalDateTime;

public class Main {
    public static double convertTimeToHour(long time) {
        return convertTimeToDay(time) * 24;
    }/*from   www.  j a  v a2 s . c  om*/

    public static double convertTimeToDay(Long timestamp) {
        java.sql.Timestamp tiempoint = new java.sql.Timestamp(timestamp);
        LocalDateTime ldt = tiempoint.toLocalDateTime();
        double res = ((double) ldt.getHour()) / 24 + ((double) ldt.getMinute()) / (24 * 60)
                + ((double) ldt.getSecond()) / (24 * 60 * 60);
        return res;
    }
}

Related

  1. convertNanoToTime(long nanos)
  2. convertTime(long time)
  3. convertTime(String time)
  4. convertTime2String(long time)
  5. convertTime2TS(long time)
  6. convertToDateTime(java.util.Date date, String time)
  7. convertToTime(Date toDate)
  8. convertToTime(java.util.Date date)
  9. getCNTimezone()