Created
May 24, 2016 21:52
-
-
Save krishnanraman/d5ad0f5bfd92735dc336dd4875e404cc to your computer and use it in GitHub Desktop.
get prev day
This file contains 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
Given a date like 2015-12-31, obtain 2015-12-30 | |
*/ | |
def getPreviousDay(mydate:String):String = { | |
val fmt = new SimpleDateFormat("yyyy-MM-dd") | |
val date = fmt.parse(mydate) | |
val cal = Calendar.getInstance | |
cal.setTime(date) | |
cal.add(Calendar.DAY_OF_MONTH,-1) | |
fmt.format(cal.getTime) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment