tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Tools and Libs > Jodd > Commons > Get month length

Get month length 

Jodd is an open-source java library with lot of reusable components and feature rich utilities. This requires the library jodd-3.3.2.jar to be in classpath. The following example shows how to use TimeUtil.getMonthLength() API. It returns the number of days in specified month.

File Name  :  
com/bethecoder/tutorials/jodd/time/GetMonthLengthTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.jodd.time;

import jodd.datetime.TimeUtil;

public class GetMonthLengthTest {

  /**
   @param args
   */
  public static void main(String[] args) {

    int monthLength = TimeUtil.getMonthLength(19821);
    System.out.println("Length of 1982, JAN month : " + monthLength);
    
    monthLength = TimeUtil.getMonthLength(20002);
    System.out.println("Length of 2000, FEB month : " + monthLength);

    monthLength = TimeUtil.getMonthLength(20129);
    System.out.println("Length of 2012, SEP month : " + monthLength);
    
  }

}
   

It gives the following output,
Length of 1982, JAN month : 31
Length of 2000, FEB month : 29
Length of 2012, SEP month : 30


                    Print

   



Books Recommendation

 
 
bl  br