I am trying to update just the day component on a datetime field on my sqlite database using:
UPDATE recur SET start_date = date('%d', '05')
I have read the documentation but cannot seem to figure out how to do this, can anyone help?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are good examples in the online documentation. You’re not calling the
datefunction correctly. You need something like:I’m not sure what date you need to start from, so I used
'now', but you could pass in a date field (from your database, for example) or a valid date string (like “2012-12-05”, at least on my system).Edit
For example
Will return:
Keep in mind that sometimes when you’re starting with a string it’s easier to use string functions to do this type of manipulation. However using the date function will validate you are starting with a well formatted date.
Edit 2
If you’re also having trouble figuring out the
UPDATEsyntax, putting it all together you get:I’m not sure what exactly you need for the
WHEREclause so be sure your selecting the correct records before you run this.