Skip to content

Instantly share code, notes, and snippets.

@BBischof
Last active May 12, 2016 00:21
Show Gist options
  • Save BBischof/c8e4026fb88ca06b2d092185c2a437fe to your computer and use it in GitHub Desktop.
Save BBischof/c8e4026fb88ca06b2d092185c2a437fe to your computer and use it in GitHub Desktop.
This is the result of JODA not being serializable in scala, resorting to utter bullshit, assumes year is 2016.
def fake_dt_formatter(month: String, day: String, time: String): Int = {
val YEAR_2016 = 1451606400
val days: List[Int] = List(0,31,60,91,121,152,182,213,243,274,304,335)
val month_num = days("JanFebMarAprMayJunJulAugSepOctNovDec".indexOf(month) / 3) * 86400
val day_num = (day.toInt-1) * 86400
val time_vals = time.split(":")
val time_num = time_vals(0).toInt * 3600 + time_vals(1).toInt * 60 + time_vals(2).toInt
return YEAR_2016 + month_num + time_num + day_num
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment