Jump to content

Archived

This topic is now archived and is closed to further replies.

alvin567

[Cakephp] Between Date condition?

Recommended Posts

$conditions['Claim.created <= '] = date('Y-m-d', $m2);

 

lets say I have two date,$m1 and $m2,how do I set the condition to be between the date?

Share this post


Link to post
Share on other sites

Great!!

 

    $conditions = array(

                        'Renewal.year' => $renewal_period,

                        'Renewal.void' => 0,

                        'Renewal.approved' => 3,

                        'Claim.void' => 0,

                        'Claim.draft' => 0

                        );

 

Can I do this?

 

  array_push($conditions, array('Claim.created BETWEEN ? and ?' => array(strtotime($start), strtotime($end))));

 

 

Share this post


Link to post
Share on other sites

On top of that I have this error?

Warning (2): mssql_query() [function.mssql-query]: message: Conversion failed when converting date and/or time from character string. (severity 16) [CORE/cake-1.2.6/libs/model/datasources/dbo/dbo_mssql.php, line 181]

Warning (2): mssql_query() [function.mssql-query]: General SQL Server error: Check messages from the SQL Server. (severity 5) [CORE/cake-1.2.6/libs/model/datasources/dbo/dbo_mssql.php, line 181]

Warning (512): SQL Error: Conversion failed when converting date and/or time from character string. [CORE/cake-1.2.6/libs/model/datasources/dbo_source.php, lin

Share this post


Link to post
Share on other sites

array_push($conditions,array('Claim.created BETWEEN ? and ?' => array($startdate, $enddate)));

there seems to be an error how do I go about it?

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.