Aswathy S Aswathy S - 1 year ago 92
MySQL Question

how can i implement date conversions in typo3 repository methods

I have a query

SELECT * FROM `my_table`
WHERE DATEDIFF(CURDATE(), CAST(from_unixtime(tstamp) AS DATE)) >=365

How can I convert to repository method

$query = $this->createQuery();
$query->greaterThanOrEqual(????, 365)
return $query->execute();

Answer Source

You can just calculate that date with PHP:

$timestamp = time() - 86400 * 365;
    $query->lessThanOrEqual('tstamp', $timestamp )
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download