Java Hour Hours()

Here you can find the source of Hours()

Description

Hours

License

Open Source License

Declaration

public static String Hours() 

Method Source Code

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static String Hours() {
        Calendar c = Calendar.getInstance();
        c.setTime(new Date());
        int year = c.get(Calendar.YEAR);
        int month = c.get(Calendar.MONTH) + 1;
        int date = c.get(Calendar.DATE);
        int hour = c.get(Calendar.HOUR_OF_DAY);
        return year + "-" + (month < 10 ? "0" : "") + month + "-" + (date < 10 ? "0" : "") + date + "-"
                + (hour < 10 ? "0" : "") + hour;
    }/*from  ww  w . ja  va 2  s. co m*/
}

Related

  1. hour()
  2. hour()
  3. hourAgo()
  4. hourCompletion(boolean hourPresent, int hour, boolean minutePresent, int minute, boolean secondPresent, int second, boolean milliPresent, int milli, String choice)
  5. HourNow()
  6. hours(int hours)
  7. hoursAndMinsToMilliseconds(int sign, int hours, int minutes)
  8. isHour(int hour)
  9. nextHour(Date date)