Java Day of getTimeOfDaySeconds()

Here you can find the source of getTimeOfDaySeconds()

Description

Calculates current time as a float

License

Open Source License

Return

Time of Day in Seconds

Declaration

public static float getTimeOfDaySeconds() 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    private static Calendar cal = Calendar.getInstance();
    private static SimpleDateFormat hour = new SimpleDateFormat("HH"), minute = new SimpleDateFormat("mm"),
            second = new SimpleDateFormat("ss");

    /**/*w  ww .j a v  a2 s .c  o  m*/
     * Calculates current time as a float
     * 
     * @return      Time of Day in Seconds
     */
    public static float getTimeOfDaySeconds() {
        return (((Float.parseFloat(hour.format(cal.getTime())) * 3600)
                + (Float.parseFloat(minute.format(cal.getTime())) * 60)
                + Float.parseFloat(second.format(cal.getTime()))) * 1000);
    }
}

Related

  1. getStringAfterNDay(String str, int n)
  2. getStringDay(Calendar cal)
  3. getTargetDay(String day, int beforeOrAfterDays)
  4. getTheDayBefore(Date date)
  5. getThursday(String date)
  6. getTimestamp(String format, Integer daysInFuture)
  7. getTwoDay(String sj1, String sj2)
  8. getTwoDay(String sj1, String sj2)
  9. getTwoDay2String(String startDate, String endDate, Format format)