Oracle timestamp in framework 2

For programming and general questions on Zend Framework
Post Reply
Posts: 1
Joined: Sat Sep 28, 2013 3:17 am

Oracle timestamp in framework 2

Post by wenf886 » Sat Sep 28, 2013 3:22 am

I met a problem. It took me several hours but failed.
I am using zend framework 2 and trying to insert current time stamp into oracle database table.
In my oracle database,
to_timestamp('2000-1-1 0:0:0', 'yyyy-mm-dd hh24:mi:ss') can be inserted as data in sql sentence.

I have tried several ways in zf2 controller.
$data['ts_last_login'] = date('Y-m-d H:i:s');
$data['ts_last_login'] =Zend_Db_Expr('NOW()'); Actually, I can't find Zend_Db_Expr in framework 2.

But both fails. (invalid month) Who can help me ? THanks in advance.

Posts: 39
Joined: Mon Aug 17, 2009 4:56 pm

Re: Oracle timestamp in framework 2

Post by chetzel » Sat Sep 28, 2013 1:12 pm


please check your NLS_DATE_FORMAT/NLS_TIMESTAMP_FORMAT session parameters:

Code: Select all

select	*
from	nls_session_parameters
I suppose they have the wrong format. Set these parameters appropriately. Inserting timestamps as simple strings should then be possible even without "to_timestamp()"!

Regards, Carsten

Post Reply