Here you can find the source of getTodayAsLong()
public static long getTodayAsLong()
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.GregorianCalendar; import java.util.TimeZone; public class Main { /**/*from ww w . j a va2 s .c o m*/ * Liefert das heutige Datum als long * * @return */ public static long getTodayAsLong() { long ret = 0; GregorianCalendar calToday = new GregorianCalendar(TimeZone.getTimeZone("Europe/Berlin")); calToday.setFirstDayOfWeek(Calendar.SUNDAY); try { ret = getDateAsLong(calToday.getTime()); } catch (NumberFormatException e) { } return ret; } public static Long getDateAsLong(java.util.Date _date) { long ret = 0; GregorianCalendar calDatum = new GregorianCalendar(TimeZone.getTimeZone("Europe/Berlin")); calDatum.setFirstDayOfWeek(Calendar.SUNDAY); calDatum.setTime(_date); try { ret = Long.valueOf(calDatum.get(GregorianCalendar.YEAR) + "" + fillTwoSigns((calDatum.get(GregorianCalendar.MONTH) + 1)) + "" + fillTwoSigns(calDatum.get(GregorianCalendar.DAY_OF_MONTH))); } catch (NumberFormatException e) { } return ret; } public static String fillTwoSigns(int _number) { String ret = String.valueOf(_number); if (_number <= 9) { ret = "0" + ret; } return ret; } }