I have my app hosted in a London Server. I am in Madrid, Spain. So the timezone is -2 hours.
How can I obtain the current date / time with my time zone.
Date curr_date = new Date(System.currentTimeMillis());
e.g.
Date curr_date = new Date(System.currentTimeMillis("MAD_TIMEZONE"));
DateTimeZone zone = DateTimeZone.forID("Europe/Madrid");
DateTime dt = new DateTime(zone);
int day = dt.getDayOfMonth();
int year = dt.getYear();
int month = dt.getMonthOfYear();
int hours = dt.getHourOfDay();
int minutes = dt.getMinuteOfHour();
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…