Getting the date from a ResultSet for use with java.time classes

Most database vendors don’t support JDBC 4.2 yet. This specification says that the new java.time-types like LocalDate will/should be supported using the existing methods setObject(…) and getObject(). No explicit conversion is required and offered (no API-change). A workaround for the missing support can be manual conversion as described on the Derby-mailing list. Something like: LocalDate … Read more

JavaScript’s getDate returns wrong date

The Date.parse method is implementation dependent (new Date(string) is equivalent to Date.parse(string)). While this format will be available on modern browsers, you cannot be 100% sure that the browser will interpret exactly your desired format. I would recommend you to manipulate your string, and use the Date constructor with the year, month and day arguments: … Read more

Rounding SQL DateTime to midnight

In SQL Server 2008 and newer you can cast the DateTime to a Date, which removes the time element. WHERE Orders.OrderStatus=”Shipped” AND Orders.ShipDate >= (cast(GETDATE()-6 as date)) In SQL Server 2005 and below you can use: WHERE Orders.OrderStatus=”Shipped” AND Orders.ShipDate >= DateAdd(Day, Datediff(Day,0, GetDate() -6), 0)

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