Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String getCurrentTime() {
- return getCurrentTime("yyyy/MM/dd HH:mm:ss");
- }
- public static String getTimeFormatted(long millis, String format) {
- Date date = new Date(millis);
- DateFormat formatter = new SimpleDateFormat(format);
- return formatter.format(date);
- }
- public static String getTimeFormatted(Date date, String format) {
- DateFormat formatter = new SimpleDateFormat(format);
- return formatter.format(date);
- }
- public static String getTimeFormatted(long millis) {
- return getTimeFormatted(millis, "HH:mm:ss dd.MM. yyyy");
- }
- public static String getCurrentUserTime() {
- return getTimeFormatted(System.currentTimeMillis());
- }
- public static String getCurrentTime(String format) {
- DateFormat dateFormat = new SimpleDateFormat(format);
- Calendar calendar = Calendar.getInstance();
- return dateFormat.format(calendar.getTime());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement