Created
December 28, 2016 16:41
-
-
Save fbukevin/b4b68fc8ddf49fc0af48170659bb609b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TimeTool { | |
public Date stringToDate(String dateString){ | |
Date date = null; | |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); | |
try { | |
date = sdf.parse(dateString); | |
} catch(ParseException e) { | |
} | |
return date; | |
} | |
public String dateToString(Date date){ | |
SimpleDateFormat ft = new SimpleDateFormat ("yyyy/MM/dd HH:mm:ss"); | |
String dateString = ft.format(date); | |
return dateString; | |
} | |
public String getCurrentTimeString(){ | |
SimpleDateFormat ft = new SimpleDateFormat ("yyyy/MM/dd HH:mm:ss"); | |
String dateString = ft.format(new Date()); | |
return dateString; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment