Well in my app I want to get current date and month abnd local hour (currentTimeZone hour) and depending on its value display some things.
i have read several sollutions and I have used the following:
Calendar c = Calendar.getInstance();
int day=c.get(Calendar.DATE);
int month=c.get(Calendar.MONTH);
or this
Time today = new Time(Time.getCurrentTimezone());
today.setToNow();
int day2=today.monthDay;
int month2=today.month;
my questions are:
1)which of this is more "Stable" considering their results? I mean that it will not have any problem.
2)Moreover, did they both take into consideration the TimeZone? I think that the second one does, but what about the calendar?
3)I tried this code that I have found:
SimpleDateFormat s = new SimpleDateFormat("ddMMyyyyhhmmss");
String format = s.format(new Date());
and i get the error that Date() must have an argument. weird because in every answer they use it like that.
What is wrong?
4) What do you suggest me to use? The only thing I want is a simple comparison between current month,date,hour with some stored in memory. (for example if its January 29, display that event. if it is 19.00 am send notification and so on.)