If I am running unix command
echo 1378223625 | xargs -L 1 -I '{}' date -d "@{}" "+%d-%m-%Y-%H-%M %Z"
result is 03-09-2013-17-53 CEST
If I am running from java
public class DateExperiment {
public static void main(String[] args) {
DateFormat df = new SimpleDateFormat("dd-MM-yyyy-H-m z");
System.out.println(df.format(1378223625) );
}
}
my result is 16-01-1970-23-50 CET
unix command gives correct result but java is giving me wrong result.
Can anybody explain why am getting this discrepancy? what is the mistake?
but java is giving me wrong result. No, your expectations are wrong.