Skip to content

Commit

Permalink
1. Added method to get current date time in given format.
Browse files Browse the repository at this point in the history
2. Updated library version.
  • Loading branch information
amitjangid80 committed Nov 3, 2018
1 parent 48569cd commit 632c505
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 33 // this indicates the number of releases of library
versionName "1.3.5" // this indicates the current version of library
versionCode 34 // this indicates the number of releases of library
versionName "1.3.6" // this indicates the current version of library
}

buildTypes {
Expand Down
26 changes: 25 additions & 1 deletion app/src/main/java/com/amit/utilities/DateTimeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,35 @@
* <p>
* this class will help in formatting date and time
**/
@SuppressWarnings("unused, deprecation")
@SuppressWarnings({"unused, deprecation", "WeakerAccess"})
public class DateTimeUtils
{
private static final String TAG = DateTimeUtils.class.getSimpleName();

/**
* 2018 November 03 - Saturday - 12:00 PM
* get current date time method
*
* this method will current date time in string type
*
* @param inDateTimeFormat - Pass the date or date time format you
* want to get date or date time in format
* Ex: dd-MM-yyyy or dd-MM-yyyy hh:mm
*
* @return - date or date time returned
**/
private static String getCurrentDateTime(String inDateTimeFormat)
{
if (inDateTimeFormat != null && inDateTimeFormat.length() != 0)
{
String dateTime = java.text.DateFormat.getDateTimeInstance().format(new Date());
return DateTimeUtils.formatDateTime(dateTime, inDateTimeFormat);
}

Log.e(TAG, "getCurrentDateTime: given date format is not valid");
return "";
}

/**
* format date time method
* <p>
Expand Down

0 comments on commit 632c505

Please sign in to comment.