I'm looking to get Jetpack stats for yesterday, but am having trouble figuring out how to get yesterday from stats_get_csv.
stats_get_csv has two seemingly relevant parameters, "days" which says how many days to go back, and "end" which says what day to end on. So the obvious parameters would be to use yesterday as the "end" on a two-day search. But this is just showing everythingm including the current day's stats.
$yesterday = date('Y-m-d',strtotime('yesterday')); $top_posts_yesterday = stats_get_csv('postviews', 'days=2&limit=12&date=' . $yesterday);
specifically, these parameters doesn't get me yesterday (on Feb 12):
What am I doing wrong?
UPDATE: I was doing two things wrong: first, the "date" attribute there should be "end". Second, "days" is calculated from "end" backwards, not from the current day.