Questions tagged [date-arithmetic]

The term 'date-arithmetic' refers to determining via code such information as how many days, hours, etc. between two calendar dates, and determining the last day of the month, or whether a date is a weekday or a weekend. Be sure to also include the appropriate programming or database tag.

Many computer languages provide for date arithmetic, including , , and languages. Most languages store data with a type of date internally as a number of days since a certain date, such as January 1st 1970 for Unix.

Typical Considerations

  • Basic calculations such as number of days between two dates, number of months between two dates, etc.
  • Scheduling problems often involve how to determine the fifth business day of the month, the last day of the month, the fourth Thursday of the month
  • Regional or Client-specific concerns include whether certain days are holidays, etc.
  • Week number of the year (ISO: Monday as first day of week, Unix: Sunday as first day of week)
1101 questions
-2
votes
2 answers

Datetime - String Round Trip

This gets me a string. How do I go back to a datetime object so I can do some date arithmetic and such? from datetime import datetime, timezone s = datetime.now(timezone.utc).astimezone().isoformat() This code snippet produces a string that I am…
mcu
  • 3,302
  • 8
  • 38
  • 64
-2
votes
2 answers

Arithmetic operation inside switch statement

I want to know if exists a solution to do that: I need to to use the arithmetic operations inside all cases and at the final to show the last result. Functions.php
George George
  • 187
  • 2
  • 18
-2
votes
1 answer

Sum the differences between dates

I have 2 tables, master and detail, that both contain dates related to events. The first contain the master record's begin and end date. The second contains various gaps, that also have a beginning and an end, related to the master record and…
DylanW80
  • 65
  • 3
  • 12
-2
votes
1 answer

Credit for sales report filing time

I have two date_time fields. The first is the date_time of the sale and the second is the date_time the sales report is filed. In order for the salesperson to obtain credit, the sales report has to be filed by midnight on the date after the sale…
Anna
  • 3
  • 2
-2
votes
2 answers

DATEADD function in Oracle

I have the following sybase code that I would like to use in Oracle: (DATEADD(dd,1-DAY(c_date),c_date) How could I go about in changing this code up so that it would work in Oracle?
user1753675
  • 145
  • 1
  • 1
  • 10
-2
votes
1 answer

How to add 2 dates in Oracle sp?

How can we add two dates in oracle? For example in sql we can do this, " date_1 + date_2 " how can we achieve the same thing in Oracle
Pinchas K
  • 1,541
  • 3
  • 13
  • 19
-3
votes
3 answers

Date comparison in Oracle 11g

I'm new to Oracle 11g & I have a question about a query. I have a table dummy which has created_date column of type Date. I want a query which will return all the records where created_date + 7 days is less than today's date. What type of query in…
Mike
  • 7,606
  • 25
  • 65
  • 82
-3
votes
4 answers

Oracle Date - Get 1 Jan of given year

I have year as a parameter in proc which can be 2017,2018,etc. I want get 1 Jan of that year in Date Format in oracle server. Is there any way to do that ?
Yogesh
  • 354
  • 2
  • 15
-3
votes
1 answer

Crystal Reports formula for number of workdays between first day of current quarter and currentdate

I'm having trouble with this. If I find an answer I'll include it in my post. SQL to calculate number of days in current quarter, for instance. I can't figure it with Crystal Syntax which is where I fall short. for starters, SQL to get 1st day of…
jawz101
  • 89
  • 1
  • 11
-3
votes
3 answers

How to show the date/time two hours from current time

I'd like to show the date/time, two hours after the current time. DateTime value = DateTime.Now; DateTime newvalue = value.AddHours(2); label5.Text = ???
Boom
  • 19
  • 1
  • 6
-3
votes
1 answer

calculating with java with two file program

I have a question on how to calculate with java. In my case, I think I am doing the calculations right, but when I run it, I get a few 0s and some absurd number. How can I fix this? Any help will be greatly appreciated. Below is my code: public…
-3
votes
1 answer

Calculate the real time of day while in a moving jet plane

Using VB.Net coding I would like to calculate what the real time is while I'm traveling in a moving jet plane. I will be using this information to remind myself when the time is close to the following times: 04:00, 13:00, 17:00, 19:00 and 21:00 The…
Emad-ud-deen
  • 4,734
  • 21
  • 87
  • 152
-4
votes
2 answers

How do I remove employees who have turned 18 - mysql?

SELECT birthday FROM employees WHERE ((DATEDIFF(Year,birthday())>'18')
-4
votes
1 answer

Find current date (require for wishing happy birthday)

I want to select current system date from a table of DOB(date of birth) in member_info table DESIGNATION DOB GENDER MARITAL_STATUS STUDENT 4-Jun-1996 MALE SINGLE BUSINESS…
-4
votes
2 answers

Return employee's who were hired in first half of the month

How can I return the employee names from table hr.employees who were hired on first half of the month, i.e. with a date of 1st to 15th of that month.
Vikas Pal
  • 83
  • 1
  • 1
  • 10
1 2 3
73
74