Advertisement
Guest User

Untitled

a guest
Aug 1st, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.42 KB | None | 0 0
  1.    
  2.     def verifyToken(expiration: String) = {
  3.         //"2014-05-28T22:19:10Z"
  4.         val exp_format = expiration.split("T")(1).split("Z")(0) + " " + expiration.split("T")(0)
  5.  
  6.         val sdf = new SimpleDateFormat("HH:mm:ss yyyy-M-DD")
  7.         val token_date = sdf.parse(exp_format)
  8.         val current_date = new Date()
  9.  
  10.         val difference = current_date.getTime() - token_date.getTime();
  11.  
  12.         if (difference > 0) {
  13.             true
  14.         } else {
  15.             false
  16.         }
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement