0

I want insert the current date and time into my table.... I used this query

insert into tbl_reminder values("Description",current_timestamp);

but it insert the wrong time... actually the timestamp in my emulator is 2010-09-16 18:40:06 but the inserted timestamp value is 2010-09-16 13:10:06 what i do to insert the exact time...

2
  • How do you get your current_timestamp? Commented Sep 16, 2010 at 13:16
  • current_timestamp is a default keyword to insert the current time in database...so i didn't give any value for that... Commented Sep 16, 2010 at 13:21

1 Answer 1

1

Insert it enclosed within Quotes, the date will be stored as a string.

sqlite doesn't has a Date datatype.

Now, the following is just incase you are planning to use the Date column for Comparisions...

Speaking from experience, i would advice you store it as Long Integer, as a Unix Timestamp, it lets you do Comparison between dates, which would otherwise be very difficult.

You'll obviously have to convert it to-and-fro but in the long run it's a better stratergy.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.