SQL – The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

I have faced the same problem a week ago. The problem is with the time zone setting. Specify in other formats like mm/dd/yyyy (usually works). Specifying the date as 30/12/2013 resulted in the error for me. However, specifying it as mm/dd/yyyy format worked. If you need to convert your input the you can try looking into the CONVERT method. … Read more

DateTime2 vs DateTime in SQL Server

The MSDN documentation for datetime recommends using datetime2. Here is their recommendation: Use the time, date, datetime2 and datetimeoffset data types for new work. These types align with the SQL Standard. They are more portable. time, datetime2 and datetimeoffset provide more seconds precision. datetimeoffset provides time zone support for globally deployed applications. datetime2 has larger date range, a larger default fractional precision, and optional user-specified precision. Also depending on the user-specified … Read more

Moment js date time comparison

I believe you are looking for the query functions, isBefore, isSame, and isAfter. But it’s a bit difficult to tell exactly what you’re attempting. Perhaps you are just looking to get the difference between the input time and the current time? If so, consider the difference function, diff. For example: A few other things: There’s an error in the first line: … Read more

Converting string to Date and DateTime

Use strtotime() on your first date then date(‘Y-m-d’) to convert it back: Make note that there is a difference between using forward slash / and hyphen – in the strtotime() function. To quote from php.net: Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)