How can I calculate what date Catholic Good Friday falls on, given a year?

Here’s a great article that should help you build your algorithm http://www.codeproject.com/KB/datetime/christianholidays.aspx Based on this example, you should be able to write: DateTime goodFriday = EasterSunday(DateTime.Now.Year).AddDays(-2); Full Example: public static DateTime EasterSunday(int year) { int day = 0; int month = 0; int g = year % 19; int c = year / 100; int … Read more

How to subtract hours from a date in Oracle so it affects the day also

Others have commented on the (incorrect) use of 2/11 to specify the desired interval. I personally however prefer writing things like that using ANSI interval literals which makes reading the query much easier: sysdate – interval ‘2’ hour It also has the advantage of being portable, many DBMS support this. Plus I don’t have to … Read more

How can I calculate what date Good Friday falls on, given a year?

Here’s a great article that should help you build your algorithm http://www.codeproject.com/KB/datetime/christianholidays.aspx Based on this example, you should be able to write: DateTime goodFriday = EasterSunday(DateTime.Now.Year).AddDays(-2); Full Example: public static DateTime EasterSunday(int year) { int day = 0; int month = 0; int g = year % 19; int c = year / 100; int … Read more

Oracle: how to add minutes to a timestamp?

In addition to being able to add a number of days to a date, you can use interval data types assuming you are on Oracle 9i or later, which can be somewhat easier to read, SQL> ed Wrote file afiedt.buf SELECT sysdate, sysdate + interval ’30’ minute FROM dual SQL> / SYSDATE SYSDATE+INTERVAL’30’ ——————– ——————– … Read more