Thursday, 28 August 2014

Pretty snippet example for formatting millis to own date format

Here is that pretty snippet

 public static String getDate(long milliSeconds, String dateFormat)  
   // Create a DateFormatter object for displaying date in specified format.  
   SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);  
   // Create a calendar object that will convert the date and time value in milliseconds to date.   
    Calendar calendar = Calendar.getInstance();  
    return formatter.format(calendar.getTime());  

Took source from:

And here is pattern structure for formatting:

Dday in year(Number)189
Eday of week(Text)E/EE/EEE:Tue, EEEE:Tuesday, EEEEE:T
Fday of week in month(Number)2 (2nd Wed in July)
Gera designator(Text)AD
Hhour in day (0-23)(Number)0
Khour in am/pm (0-11)(Number)0
Lstand-alone month(Text)L:1 LL:01 LLL:Jan LLLL:January LLLLL:J
Mmonth in year(Text)M:1 MM:01 MMM:Jan MMMM:January MMMMM:J
Sfractional seconds(Number)978
Wweek in month(Number)2
Ztime zone (RFC 822)(Time Zone)Z/ZZ/ZZZ:-0800 ZZZZ:GMT-08:00 ZZZZZ:-08:00
aam/pm marker(Text)PM
cstand-alone day of week(Text)c/cc/ccc:Tue, cccc:Tuesday, ccccc:T
dday in month(Number)10
hhour in am/pm (1-12)(Number)12
khour in day (1-24)(Number)24
mminute in hour(Number)30
ssecond in minute(Number)55
wweek in year(Number)27
yyear(Number)yy:10 y/yyy/yyyy:2010
ztime zone(Time Zone)z/zz/zzz:PST zzzz:Pacific Standard Time
'escape for text(Delimiter)'Date=':Date=
''single quote(Literal)'o''clock':o'clock

Took source from:

Monday, 4 August 2014

Caused by: java.lang.NoClassDefFoundError: java/util/HashMap$Entry in gradle using ConfigSlurper

If suddently  you gets this error:

 Caused by: java.lang.NoClassDefFoundError: java/util/HashMap$Entry  
it might means you are not using Java 7 anymore. So please be nice to check in console using command:

 java -version  
you have java version lower than 8...

The best way is to go Start>Control Panel>Add/Remove apps> and uninstall java jdk/jre version 8, leaving version 7.