-2

I am new to Android Development, and am trying to figure out how I can incorporate the current date (as set on the device) in to the Java code. I have my minimum API set as 10, which needs to be kept to, but can only figure out how to do it using "getInstance()" which requires an API level of 24. Is there a way of doing this that is compatible with API 10? Thanks in advance.

Please note, the answer provided at How can I get current date in Android? requires API Level 24, due to the "getInstance()", so does not work.

Community
  • 1
  • 1
Matthew Whittenham
  • 121
  • 1
  • 1
  • 7

1 Answers1

1

Try getDateInstance(), it comes from java.text.DateFormat and is supported since API 1.

Qrchack
  • 899
  • 1
  • 10
  • 20
  • Thanks for your help. However, I am not trying to get a date 'formatter' or variable, I am trying to obtain the actual date as is set in the system settings of the device, that the app is run on, as a value in to my java code. – Matthew Whittenham Nov 17 '16 at 20:43