Change HH
to hh
as
long timeInMillis = System.currentTimeMillis();
Calendar cal1 = Calendar.getInstance();
cal1.setTimeInMillis(timeInMillis);
SimpleDateFormat dateFormat = new SimpleDateFormat(
"dd/MM/yyyy hh:mm:ss a");
dateforrow = dateFormat.format(cal1.getTime());
Note that dd/mm/yyyy
– will give you minutes instead of the month.
Related Contents:
- Android parse String to Date – unknown pattern character ‘X’
- Get value of day month from Date object in Android?
- SimpleDateFormat warning To get local formatting use getDateInstance(), getDateTimeInstance(), or getTimeInstance(),
- How do I discover memory usage of my application in Android?
- How to call a SOAP web service on Android [closed]
- Is there a way to automatically generate getters and setters in Eclipse?
- Base 64 encode and decode example code
- Why Android Studio says “Waiting For Debugger” if am NOT debugging?
- How to get the selected index of a RadioGroup in Android
- Android Studio error: “Manifest merger failed: Apps targeting Android 12” [duplicate]
- Android Studio was unable to find a valid Jvm (Related to MAC OS)
- Android search with Fragments
- Convert InputStream to BufferedReader
- Unable to install Android Studio in Ubuntu [duplicate]
- why use Retrofit when we have OkHttp
- Replacing a fragment with another fragment inside activity group
- exposed beyond app through ClipData.Item.getUri
- Convert Json Array to normal Java list
- What’s the best practice to round a float to 2 decimals? [duplicate]
- How do I open the SearchView programmatically?
- Custom ListView click issue on items in Android
- Firebase No properties to serialize found on class
- How to hide the soft keyboard inside a fragment?
- Why use Enums instead of Constants? Which is better in terms of software design and readability
- This app is not authorized to use Firebase Authentication.Please verify that the correct package name and SHA-1 are configured in the Firebase Console
- Why is “using getString() to get device identifiers” not recommended?
- Android: How to Enable/Disable Wifi or Internet Connection Programmatically
- Android custom Row Item for ListView
- Android: Creating a Circular TextView?
- Left align text inside a button in Android
- Android Studio layout editor cannot render custom views
- android hide toolbar in specific fragment
- Error building AAB – Flutter (Android) – Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available
- How to solve ‘Program type already present: com.google.common.util.concurrent.ListenableFuture’?
- Android – programmatically change the state of a switch without triggering OnCheckChanged listener
- convert timestamp into current date in android
- Why is my JSONObject related unit test failing?
- How to create a file — including folders — for a given path?
- How to get current year in android?
- Optional parts in SimpleDateFormat
- e.printStackTrace(); in string
- How to register some URL namespace (myapp://app.start/) for accessing your program by calling a URL in browser in Android OS?
- How to change spaces to underscore and make string case insensitive?
- Android data binding : view does not update when property is changed
- NPE in ChangeCurrentByOneFromLongPressCommand (on Samsung devices w/ Android 4.3)
- java.util.ConcurrentModificationException in activity onCreate
- How to “wait” a Thread in Android
- How to change ImageView source in android
- Why FloatBuffer instead of float[]?
- Preload multiple images with Glide