I want to save the current time in SQLite DB. I am using the following code syntax –
private static final String CREATE_GROUP_MESSAGES_TABLE = "create table if not exists "
+ TABLE_GROUP_MESSAGE
+ "( "
+ GROUP_NAME
+ " VARCHAR NOT NULL, "
+ ENTRY_FROM
+ " VARCHAR NOT NULL, "
+ COLUMN_GROUPTEXT
+ " TEXT NOT NULL, "
+ COLUMN_ISSENDMESSAGE
+ " VARCHAR NOT NULL, "
+ COLUMN_GROUPIMAGEPATH
+ " TEXT NOT NULL, "
+ GROUP_COLUMN_TYPE
+ " INTEGER NOT NULL, "
+ GROUP_COLUMN_KEY
+ " INTEGER primary key autoincrement, "
+ GROUP_COLUMN_TIMESTAMP
+ " DATETIME DEFAULT CURRENT_TIMESTAMP);";
But the above is giving me the time as per the GMT basis. How to get/store the time as per GMT+5 or anything else.
Thanks
Just do:
And it will be defaulted to the user’s localtime as opposed to GMT