Here you can find the source of nowDayString()
public static String nowDayString()
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { static DateFormat dayDateFormat = new SimpleDateFormat("yyyy-MM-dd"); public static String nowDayString() { return dayDateFormat.format(dateTimeConvert(0)); }//from ww w .j a v a2s. c o m public static Date dateTimeConvert(int minute) { Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.MINUTE, calendar.get(Calendar.MINUTE) + minute); return calendar.getTime(); } }