Created
February 14, 2016 16:02
-
-
Save srigalamilitan/f3f45e2f4a21be8dba67 to your computer and use it in GitHub Desktop.
Fast Date Format www.putracode.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.putracode.time; | |
import org.apache.commons.lang3.SystemUtils; | |
import org.apache.commons.lang3.time.FastDateFormat; | |
import java.util.Date; | |
import static com.putracode.Util.*; | |
/** | |
* Created by KrisnaPutra on 2/14/2016. | |
*/ | |
public class Learn_FastDateFormat { | |
//FastDateParser is Save for MultiThreading | |
//so you can make FastDateParser for Static variable | |
public static FastDateFormat DATE_FORMAT=FastDateFormat.getInstance("dd-MM-yyyy"); | |
public static void main(String[] args)throws Exception{ | |
printTitle("Learn Using FastDateFormat "); | |
String str_date="18-06-2015"; | |
println("Parse String To Date : "+DATE_FORMAT.parse(str_date)); | |
println("Format Date to String : "+DATE_FORMAT.format(new Date())); | |
println("Format Date from long milliseconds : "+ System.currentTimeMillis()+" -> "+DATE_FORMAT.format(System.currentTimeMillis())); | |
println("Gets a debugging string version of this formatter : "+DATE_FORMAT.toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment