Failed to get data from API: Date format must be: YYYY-MM-DD

Hi, I’ve just upgraded an old Piwik installation from version 1.0 to the latest 2.2.2.

As far as I can tell everything migrated smoothly once I regenerated the archive tables etc.

However ‘Visitors’ -> ‘Visitor Log’ doesn’t work giving the error:


Date format must be: YYYY-MM-DD, or 'today' or 'yesterday' or any keyword supported by the strtotime function (see http://php.net/strtotime for more information):

I also get a more detailed error output here [0]. It seems to make no difference if my current period is a day, week, month etc. or if I use a date range. From what I can tell looking at the stack trace this,


Piwik\Date::factory(NULL, 'Europe/London')

Should have a date string in there rather than NULL.

The URL that gives that error is:


http://piwik-migration.project/index.php?module=CoreHome&action=index&idSite=6&period=month&date=2014-02-13#/module=Live&action=indexVisitorLog&idSite=6&period=month&date=2014-02-13

Does anyone have any advice on why this is happening? The rest of Piwik seems to be working fine (all the other tabs/modes return data).

Thanks,

Felix

EDIT: Forgotten to mention I couldn’t find anything similar on the forum but did in the issue tracker. Annoying none of those bugs matched mine. I’ve probably missed something obviously or not searched well enough, in which case apologies.

[0]


WARN Live[2014-05-22 13:18:07] [6dcbd] Failed to get data from API: Date format must be: YYYY-MM-DD, or 'today' or 'yesterday' or any keyword supported by the strtotime function (see http://php.net/strtotime for more information):
#0 /var/www/plugins/Live/Visitor.php(963): Piwik\Date::factory(NULL, 'Europe/London')
#1 /var/www/plugins/Live/API.php(569): Piwik\Plugins\Live\Visitor::enrichVisitorArrayWithActions(Array, 500, 'Europe/London')
#2 [internal function]: Piwik\Plugins\Live\{closure}(Object(Piwik\DataTable))
#3 /var/www/core/DataTable.php(409): call_user_func_array(Object(Closure), Array)
#4 /var/www/core/DataTable.php(454): Piwik\DataTable->filter(Object(Closure), Array)
#5 /var/www/core/API/ResponseBuilder.php(323): Piwik\DataTable->applyQueuedFilters()
#6 /var/www/core/API/ResponseBuilder.php(128): Piwik\API\ResponseBuilder->handleDataTable(Object(Piwik\DataTable))
#7 /var/www/core/API/ResponseBuilder.php(76): Piwik\API\ResponseBuilder->renderValue(Object(Piwik\DataTable))
#8 /var/www/core/API/Request.php(217): Piwik\API\ResponseBuilder->getResponse(Object(Piwik\DataTable), 'Live', 'getLastVisitsDe...')
#9 /var/www/core/ViewDataTable/Request.php(48): Piwik\API\Request->process()
#10 /var/www/core/Plugin/ViewDataTable.php(288): Piwik\ViewDataTable\Request->loadDataTableFromAPI(Array)
#11 /var/www/core/Plugin/Visualization.php(166): Piwik\Plugin\ViewDataTable->loadDataTableFromAPI(Array)
#12 /var/www/core/Plugin/ViewDataTable.php(375): Piwik\Plugin\Visualization->buildView()
#13 /var/www/core/Plugin/Controller.php(281): Piwik\Plugin\ViewDataTable->render()
#14 /var/www/plugins/Live/Controller.php(93): Piwik\Plugin\Controller->renderReport('getLastVisitsDe...')
#15 /var/www/plugins/Live/Controller.php(87): Piwik\Plugins\Live\Controller->getLastVisitsDetails()
#16 [internal function]: Piwik\Plugins\Live\Controller->indexVisitorLog()
#17 /var/www/core/FrontController.php(500): call_user_func_array(Array, Array)
#18 /var/www/core/FrontController.php(85): Piwik\FrontController->doDispatch(NULL, NULL, NULL)
#19 /var/www/core/dispatch.php(34): Piwik\FrontController->dispatch()
#20 /var/www/index.php(47): require_once('/var/www/core/d...')
#21 {main}

Do the fields have values in your table
log_link_visit_action in the field server_time ?

Im wondering because this value to the Date factory should come directly from the DB column.

Hi,

They don’t no - presumably this means something went wrong with the migration of the database?

Is there an easy way to get them back (I still have the original database accessible) without doing the whole migration again?

Thanks,

Felix

it is possible to set it, otherwise maybe just set it to “NOW()” to keep it easy (otherwise requires a JOIN with the log_visit table which is also an option)

(Sorry for the delay in replying)

I’m a bit confused by what you mean - presumably that column (server_time) should have a datetime of when that particular action occurred?

If so I presumably need to restore that from data from somewhere else (either from another table in the migrated database or from the original old Piwik installation)? If I do need to restore data from somewhere could you advise on a suitable query?

When you say to use ‘NOW()’ do you mean to use that as a replacement value for server_time? If so wouldn’t that make all the visitor records have the wrong time?

I’m just a bit unsure as to what this value is used for and why its values were somehow lost during the migration - presumably this doesn’t normally happen?

Thanks,

Felix