0

i have app that needs to get date and time for now moment, anyone can help thank you

Calendar c = Calendar.getInstance(); 

maybe from Calender object?

NoXSaeeD
  • 924
  • 1
  • 7
  • 13

1 Answers1

2

I think a simple search on any search engine could have helped you. Eg:

String date = c.get(Calendar.YEAR) + "-"+ c.get(Calendar.MONTH)+ "-"+ c.get(Calendar.DAY_OF_MONTH) ;
String time = c.get(Calendar.HOUR_OF_DAY) + ":" + c.get(Calendar.MINUTE)+ ":" + c.get(Calendar.SECOND);
Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124