Skip to content

Instantly share code, notes, and snippets.

@amscotti
Created April 23, 2013 12:24
Show Gist options
  • Select an option

  • Save amscotti/5443143 to your computer and use it in GitHub Desktop.

Select an option

Save amscotti/5443143 to your computer and use it in GitHub Desktop.
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