I have some queries where day offsets are being coded as utc_date + 1 rather than using the date_add function. Are their any implications of using this method? I'm worried about it returning the wrong result in some circumstances, especially when the result date rolls over to a different month
MySQL Implications of doing utc_date + 1 rather than using date_add(utc_date, interval 1 day)
320 Views Asked by Tarski At
1
There are 1 best solutions below
Related Questions in MYSQL
- MySQL Select Rank
- When dealing with databases, does adding a different table when we can use a simple hash a good thing?
- Push mysql database script to server using git
- Why does mysql stop using indexes when date ranges are added to the query?
- Google Maps API Re-size
- store numpy array in mysql
- Whats wrong with this query? Using ands
- MySQL-Auto increment
- show duplicate values subquery mysql
- Java Web Application Query Is Not Working
- microsoft odbc driver manager data source name not found and no default driver specified
- Setting foreign key in phpMyAdmin
- No responses from google places text search api
- Adding to MAMP database in SQL/PHP
- I want to remove certain parent- and child-divs in all my wordpress posts with php or some other script
Related Questions in DATE
- PLSQL Need REFCURSOR DATE + TIME
- Pandas date ranges and averaging the counts
- javascript date validation to check whether it exceeds exactly next year's date
- How to INSERT date in PHP & Mysqli
- Create a list of sequential monthly dates in PHP given initial date and quantity
- Date parse with Timezone - Android
- RAILS: date_select validation
- Having trouble writing a calendar, I couldn't find a detailed guide answering my questions anywhere
- Julian Date Conversion SQL
- SQL find out how many days into year date is
- Algorithm to find the Gregorian date of the Chinese New Year of a certain Gregorian year
- Angularjs, date input : enter a date manually with a specific format
- How to convert a Microsoft SQL date to a vba string?
- Why does new java.text.SimpleDateFormat("EEEE").format(new java.util.Date(2015, 6, 9)) return the wrong day of the week?
- SQL Column Numeric to DATE
Related Questions in DATEADD
- Group by and DateAdd and simple computations SQL Server
- Problems with translating MYSQL query using date_add function and time intervals for BQ
- Query for specific time range after the basis date
- SQL Server: convert string 'n', 'hh', 'd' to global variables n, hh and d
- Issue with DATEADD Function
- DAX Month to Date
- Why does PHP DATE_ADD() function returns a syntax error
- SQL Server Datepart between, for next 'x' days
- MySQL date_add, date subquery
- DATEADD equivalent in PostgreSQL
- Trouble with Case - DateAdd function VBA
- Grouping dates by dateadd and datediff
- Trigger for incrementing a date and inserting into another table
- Why would someone use this?
- How to use the MySql 's methods DATE_ADD,DATE_FORMAT in Zend Framework2
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Using the above query (on MySQL 5.0.51a), I get the following results:
utc_date()+1= 20110204date('2011-02-28')+1= 20110229date_add('2011-02-28', INTERVAL 1 DAY)= 2011-03-01So it appears that simply adding 1 to the date causes mysql to treat the date value as an integer and not as a date. I'd recommend changing your code to use date_add.