Skip to content

Instantly share code, notes, and snippets.

@aaronjorbin
Created March 4, 2013 02:23
Show Gist options
  • Save aaronjorbin/5079473 to your computer and use it in GitHub Desktop.
Save aaronjorbin/5079473 to your computer and use it in GitHub Desktop.
Parse a twitter archive csv to pull out the time stamps
<?php
date_default_timezone_set('America/New_York');
$file = $argv[1];
$all = '';
$tweets = '';
$retweets = '';
if (($handle = fopen($file, "r")) !== FALSE) {
while (($data = fgetcsv($handle, 0, ",")) !== FALSE) {
$str = strtotime($data[5])."\n";
$all .= $str;
if ($data[3])
$retweets .= $str;
else
$tweets .= $str;
}
}
echo $tweets;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment