-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.

2
  • 3
    System.currentTimeMillis() boom. now you just gotta parse it. Date d = new Date() boom, and another one. Commented Nov 17, 2016 at 20:24
  • Date d = new Date(); is a winner. Commented Nov 17, 2016 at 20:24

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.