Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Posts: 22
Registered: ‎01-20-2011
My Device: Bold 9650
My Carrier: Verizon

SQLite - storing the CURRENT_TIMESTAMP does not store the correct time

[ Edited ]

When an entry is inserted into my SQLite table, I would like to store the exact date and time that entry is inserted.

I have what I thought was the current date and time stored by default when a record is inserted (in the observed_on field) when my table is created:


tx.executeSql("CREATE TABLE IF NOT EXISTS MTAObservations(ID INTEGER PRIMARY KEY AUTOINCREMENT, observed_on DATETIME DEFAULT CURRENT_TIMESTAMP, appVersion varchar(20), username varchar(50), passwd varchar(50), problem varchar(50), problem_detail varchar(50), borough varchar(50), subwayline varchar(50), station varchar(50), location varchar(50), base64Image TEXT, comments TEXT)", [], offline.webdb.getMTADataInfo(MTADataInfo), offline.webdb.onError);


In no other place in my app am I changing the value that is stored in observed_on - it is being populated by the default current_timestamp setting alone.


The problem is that both when I test on my PC (using Opera browser) and when I deploy to my blackberry device, the time that is being saved is the current date and time + 4 hours.

I checked both my PC and my blackberry and the time zones listed on both are the correct time zone (and the time displayed is the correct time).  

Does anyone know why this is happening?


I found another post on this forum that I thought was the same problem, but I am not sure:



states that some devices always return the time in GMT 0 regardless of the actual time zone.


I tested with BB 9650 OS 6.0 and BB 8530 OS 5.0 and both have the problem.  My Opera browser also has the same problem.


Does anyone know the code to correct this timezone problem?

I do know the timezone of all of my users - it will be

EST -4


FYI: Also related to the other post on this forum, someone created a test site:




When I tried it from my BB 9650 OS 6.0, it did return GMT 0, but from my BB 8530 OS 5.0 and from my Opera browser it returned the correct time zone (EST -4).

So I'm not sure why all the devices are having the same problem if some are returning the correct time zone.