|
Hi, I have a table in my database called "listingsdbelements" and each property has an available date which is in 'datetime' ie '1200268800' I need to increase every one by exactly 1 year. Within the table there is a column called "listingsdbelements_field_name" so when the value of "listingsdbelements_field_name" is "available" there is a value in the next column "listingsdbelements_field_value" with the date time value ie "1200268800". Can this be done?
(comments are locked)
|
|
Assuming this is SQL Server, and that I have understood the table / column name requirements correctly!!, you should be able to do this with UPDATE U SET listingsdbelements_field_value = listingsdbelements_field_value + 3110400 FROM listingsdbelements AS U WHERE listingsdbelements_field_name = 'available' Take a backup first!
(comments are locked)
|
|
What is the date value of '1200268800'?
(comments are locked)
|
|
i want to one hour with min e.g. 10-jan-2012 21:20 to 10-jan-2012 22:20 what is date format or query for using in forms You should have asked a separate question... What you need is the DATEADD function.
Aug 29 '12 at 12:32 PM
ThomasRushton ♦
(comments are locked)
|
|
Hi, I know its unix time, I would like to add 1 year ie (60x60x24x36) in seconds to each value. So is there an sql statement I can add which does this for the values and database model I mention above? ie. To get 1 year in front of 1200268800 I would need to add 3110400 which then translates 14/01/2008 into 14/01/2009 Im not too bothered about leap years I just need to add in BULK to the 800 properties which have a unix datetime.
(comments are locked)
|
1 2 next page »


What will be the desired date if you add one year to, say, 29-Feb-2008 - i.e. a leap year? Note that whatever you do (round down to 28-Feb or round up to 01-Mar) if you increment it by one year each year it won't get back to being 29-Feb in four years time - to achieve that you will need to store a Base Date and a Display Date which is N years added on (calculated from the Base Date each time)