File tree Expand file tree Collapse file tree 3 files changed +27
-3
lines changed
src/main/java/com/amit/utilities Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ android {
1010 defaultConfig {
1111 minSdkVersion 19
1212 targetSdkVersion 28
13- versionCode 33 // this indicates the number of releases of library
14- versionName " 1.3.5 " // this indicates the current version of library
13+ versionCode 34 // this indicates the number of releases of library
14+ versionName " 1.3.6 " // this indicates the current version of library
1515 }
1616
1717 buildTypes {
Original file line number Diff line number Diff line change 1313 * <p>
1414 * this class will help in formatting date and time
1515**/
16- @ SuppressWarnings ("unused, deprecation" )
16+ @ SuppressWarnings ({ "unused, deprecation" , "WeakerAccess" } )
1717public class DateTimeUtils
1818{
1919 private static final String TAG = DateTimeUtils .class .getSimpleName ();
2020
21+ /**
22+ * 2018 November 03 - Saturday - 12:00 PM
23+ * get current date time method
24+ *
25+ * this method will current date time in string type
26+ *
27+ * @param inDateTimeFormat - Pass the date or date time format you
28+ * want to get date or date time in format
29+ * Ex: dd-MM-yyyy or dd-MM-yyyy hh:mm
30+ *
31+ * @return - date or date time returned
32+ **/
33+ private static String getCurrentDateTime (String inDateTimeFormat )
34+ {
35+ if (inDateTimeFormat != null && inDateTimeFormat .length () != 0 )
36+ {
37+ String dateTime = java .text .DateFormat .getDateTimeInstance ().format (new Date ());
38+ return DateTimeUtils .formatDateTime (dateTime , inDateTimeFormat );
39+ }
40+
41+ Log .e (TAG , "getCurrentDateTime: given date format is not valid" );
42+ return "" ;
43+ }
44+
2145 /**
2246 * format date time method
2347 * <p>
You can’t perform that action at this time.
0 commit comments