How can I calculate business hours between two dates? For example we have two dates; 01/01/2010 15:00 and 04/01/2010 12:00 And we have working hours 09:00 to 17:00 in weekdays How can I calculate …
Tag: datetime
Convert INT to DATETIME (SQL)
I am trying to convert a date to datetime but am getting errors. The datatype I’m converting from is (float,null) and I’d like to convert it to DATETIME. The first line of this code works fine, but I get this error on the second line: Arithmetic overflow error converting expression to data type datetime. Answer you need to convert to
From Now() to Current_timestamp in Postgresql
In mysql I am able to do this: now in postgresql I am using this query: but I get this error: How can I resolve ? Answer Use an interval instead of an integer:
How can I compare time in SQL Server?
I’m trying to compare time in a datetime field in a SQL query, but I don’t know if it’s right. I don’t want to compare the date part, just the time part. I’m doing this: Is it correct? I’m asking this because I need to know if 08:00:00 is less or greater than 07:30:00 and I don’t want to compare
How to combine date from one field with time from another field – MS SQL Server
In an extract I am dealing with, I have 2 datetime columns. One column stores the dates and another the times as shown. How can I query the table to combine these two fields into 1 column of type datetime? Dates Times Answer You can simply add the two. if the Time part of your Date column is always zero
How to determine the number of days in a month in SQL Server?
I need to determine the number of days in a month for a given date in SQL Server. Is there a built-in function? If not, what should I use as the user-defined function?
How to convert java.util.Date to java.sql.Date?
I am trying to use a java.util.Date as input and then creating a query with it – so I need a java.sql.Date. I was surprised to find that it couldn’t do the conversion implicitly or explicitly – but I don’t even know how I would do this, as the Java API is still fairly new to me. Answer tl;dr How