Created
April 23, 2013 12:24
-
-
Save amscotti/5443143 to your computer and use it in GitHub Desktop.
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
| import 'package:http/http.dart' as http; | |
| import 'dart:json' as JSON; | |
| import 'package:intl/date_symbol_data_local.dart'; | |
| import 'package:intl/intl.dart'; | |
| DateTime getDate(String input) { | |
| var dateFormat = new DateFormat("yyyyMMddHm"); | |
| return dateFormat.parse(input); | |
| } | |
| void printDayAgo(data){ | |
| print(data); | |
| int dayAgo = (new DateTime.now()).difference(getDate(data["date"])).inDays; | |
| print("Dart SDK was updated ${dayAgo} days ago."); | |
| } | |
| void main() { | |
| String url = "http://dart-editor-archive-integration.commondatastorage.googleapis.com/latest/VERSION"; | |
| http.read(url).then((content) => JSON.parse(content)).then((data) => printDayAgo(data)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment