List of usage examples for java.util Calendar setTimeInMillis
public void setTimeInMillis(long millis)
From source file:Main.java
public static Calendar fromMilisecond(long miliseconds) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(miliseconds); return cal;// w w w . j a v a2 s .c om }
From source file:Main.java
public static int getWeekOfYear(long timeInMillis) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(timeInMillis); return cal.get(Calendar.WEEK_OF_YEAR); }
From source file:Main.java
public static String getMonthNameFromSeconds(long secs) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(secs * 1000L); SimpleDateFormat format1 = new SimpleDateFormat("MMMM"); return format1.format(c.getTime()); }
From source file:Main.java
public static String getDateFromSeconds(long secs) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(secs * 1000L); SimpleDateFormat format1 = new SimpleDateFormat("dd.MM.yyyy"); return format1.format(c.getTime()); }
From source file:Main.java
public static String getWeekDayFromSeconds(long secs) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(secs * 1000L); SimpleDateFormat format1 = new SimpleDateFormat("E"); return format1.format(c.getTime()); }
From source file:Main.java
public static String getWeekNumberFromSeconds(long secs) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(secs * 1000L); SimpleDateFormat format1 = new SimpleDateFormat("ww"); return format1.format(c.getTime()); }
From source file:Main.java
public static int getWeekday(long time) { Calendar min = Calendar.getInstance(); min.setTimeInMillis(time); return min.get(Calendar.DAY_OF_WEEK); }
From source file:Main.java
public static String dateToString(String dateString) { Calendar date = Calendar.getInstance(); date.setTimeInMillis((long) Integer.parseInt(dateString) * 1000); return date.get(Calendar.DAY_OF_MONTH) + "/" + String.format("%02d", date.get(Calendar.MONTH) + 1); }
From source file:Main.java
public static Date getDateFromLong(long time) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(time); return cal.getTime(); }
From source file:Main.java
public static String parseTime(String date) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(Long.parseLong(date)); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); return sdf.format(c.getTime()); }