Created
April 22, 2013 08:59
-
-
Save uranusjr/5433388 to your computer and use it in GitHub Desktop.
URL-compatible DateTime string from timestamp
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
String dateStringFromTimestemp(long miliseconds) | |
{ | |
Date date = new Date(miliseconds); | |
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
String dateString = format.format(date); | |
return dateString; | |
} | |
String getNotificationsAfter(long miliseconds) | |
{ | |
String dateString = URLEncoder.encode(dateStringFromTimestemp(miliseconds), "utf-8"); | |
String url = "http://www.l-somewhere.com/api/notifications?offset=0&limit=20&after_datetime=" + dateString; | |
// Pseudo code | |
URL.GET(url, onSuccess=gotNotification); | |
} | |
void gotNotification(String returnedData) | |
{ | |
// blah blah blah | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment