Java Hour Format getHoursNumberFormat()

Here you can find the source of getHoursNumberFormat()

Description

get Hours Number Format

License

Open Source License

Declaration

public static NumberFormat getHoursNumberFormat() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2007, 2009 CodeGear and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

import java.text.NumberFormat;

import java.util.Locale;

public class Main {
    public static NumberFormat getHoursNumberFormat() {
        return getHoursNumberFormat(Locale.getDefault());
    }/*from   w  ww.  j  a  va  2 s  .c  o m*/

    public static NumberFormat getHoursNumberFormat(Locale locale) {
        NumberFormat format = NumberFormat.getInstance(locale);
        format.setMaximumIntegerDigits(5);
        format.setMinimumFractionDigits(1);
        format.setMaximumFractionDigits(1);
        format.setGroupingUsed(false);
        format.setParseIntegerOnly(false);
        return format;
    }
}

Related

  1. getHHMMSS()
  2. getHHMMSS()
  3. getHHmmSS()
  4. getHourFormat(String string)
  5. getHourMinuteFormatter()
  6. getOnehouragoFormatString(String format)
  7. hoursBetween(String from, String to, String format)
  8. hoursFrom(Date date, int amount, String format)