daily pastebin goal
20%
SHARE
TWEET

Untitled

a guest Mar 13th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   def countingMinutes(str: String): Int = {
  2.     val format = "hh:mma"
  3.     val formatter: DateTimeFormatter = DateTimeFormat.forPattern(format)
  4.  
  5.     val (time1: DateTime, time2: DateTime) =
  6.       str.split("-").map(s => parseDate(s, formatter)) match { case Array(s1, s2) => (s1, s2) }
  7.  
  8.     val laterTime = if (time1.isAfter(time2)) time2.plusDays(1) else time2
  9.  
  10.     Minutes.minutesBetween(time1, laterTime).getMinutes
  11.   }
  12.  
  13.   def parseDate(text: String, formatter: DateTimeFormatter): DateTime = formatter.parseDateTime(text)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top