Here you can find the source of parseUnixDate(String paramName, String dateStr)
Parameter | Description |
---|---|
paramName | a parameter |
dateStr | a parameter |
public static Calendar parseUnixDate(String paramName, String dateStr) throws IllegalArgumentException
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { /**/*from w ww. ja v a 2s.co m*/ * Tries to parse unix date. Throws exception if fails. * * @param paramName * @param dateStr * @return */ public static Calendar parseUnixDate(String paramName, String dateStr) throws IllegalArgumentException { Calendar day; try { day = Calendar.getInstance(); long ms = Long.parseLong(dateStr); day.setTimeInMillis(ms); } catch (Exception e) { throw new IllegalArgumentException("Unparsable \"" + paramName + "\". Must be UTC time in ms", e); } return day; } }