tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Tools and Libs > Commons Lang3 > General > Fast Date Format

Fast Date Format 

Apache Commons Lang 3.0 is a java library with lot of utilities and reusable components. This requires the library commons-lang3-3.0.1.jar to be in classpath. The following example shows formatting date using FastDateFormat .

File Name  :  
com/bethecoder/tutorials/commons_lang/tests/gen/FastDateFormatTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.commons_lang.tests.gen;

import java.util.Date;

import org.apache.commons.lang3.time.DateFormatUtils;

public class FastDateFormatTest {

  /**
   @param args
   */
  public static void main(String[] args) {
      
    System.out.println(DateFormatUtils.format(new Date()
        DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern()));

    System.out.println(DateFormatUtils.format(new Date()
        DateFormatUtils.ISO_DATE_FORMAT.getPattern()));

    System.out.println(DateFormatUtils.format(new Date()
        DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.getPattern()));
  }

}
   

It gives the following output,
Tue, 08 Nov 2011 00:05:35 +0530
2011-11-08
00:05:35+05:30


                    Print

   



Books Recommendation

 
 
bl  br