Welcome Guest, Not a member yet? Register   Sign In
subtract from date.
#5

[eluser]snortop[/eluser]
Well.. first i keep getting parsing error.

Seach the web for some other way to work around. so i did finde some code and tried whit variable like.

Code:
$date = new DateTime();
$date->sub(new DateInterval('P6M'));
$this->db->where('timestamp <', $date);

and

Code:
$date = new datetime();
date_sub($date, date_interval_create_from_date_string('6 month'));
$this->db->where('timestamp <', $date);

error
Code:
Severity: 4096

Message: Object of class DateTime could not be converted to string

Filename: database/DB_active_rec.php

Line Number: 453

So i wrote here... just the 1 line i had first.

Then i though i had it whit the other code... didnt get error first time
Had die(); in it.
Then i got these error.:

Code:
A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MONTHS)' at line 2

DELETE FROM `ci_visitor_activity` WHERE timestamp < DATE_SUB(NOW(), INTERVAL 6 MONTHS)


Messages In This Thread
subtract from date. - by El Forum - 09-28-2010, 07:01 AM
subtract from date. - by El Forum - 09-28-2010, 07:06 AM
subtract from date. - by El Forum - 09-28-2010, 07:10 AM
subtract from date. - by El Forum - 09-28-2010, 07:12 AM
subtract from date. - by El Forum - 09-28-2010, 07:26 AM
subtract from date. - by El Forum - 09-28-2010, 07:34 AM
subtract from date. - by El Forum - 09-28-2010, 07:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB