Questions tagged [date-math]

Questions about performing arithmetic operations on dates and times.

129 questions
1
vote
4 answers

Calculate age (jQuery or PHP) based on date of birth [not based on user input]

I am looking for a JavaScript or PHP script that allows me to calculate somebody's age based on his/her date of birth in the mm/dd/yyyy format. I found this very helpful link "Calculate age in JavaScript" but it seems to be designed to work with…
rf2012
  • 233
  • 2
  • 7
  • 13
1
vote
3 answers

PostgreSQL: exists robust third party date-math functions to augment the built-in date operators?

I'm porting some T-SQL stored procs to PL/pgSql and, being very new to PostgreSQL, don't know what helpful utility functions might be available in the pg community. Is there a set of robust date-math functions that "nearly everybody uses" out there…
Tim
  • 8,669
  • 31
  • 105
  • 183
1
vote
2 answers

date comparison in sql server

I am trying to display records which have their date (I have a column Date in table) 30 days back from today's date. And once it gets displayed I need to make a new record by adding details with Date= today's date.. I tried this: select * from…
Siddhi
  • 13
  • 2
1
vote
3 answers

Getting Milliseconds elapsed between arbitrary date and Epoch time

If I write a simple method to return the milliseconds between epoch time and DateTime.UtcNow, I get a proper answer. However, if I write a method to return the milliseconds between some arbitrary date and epoch time, the last three digits are…
naugiedoggie
  • 300
  • 3
  • 10
0
votes
1 answer

How to calculate a date difference in calendar months?

$time_start = mktime(12,0,0,1,1,2011); $time_end = mktime(12,0,0,7,1,2011); $format = '%m months'; $start_date = new DateTime(date(DATE_ATOM,$time_start)); $end_date = new DateTime(date(DATE_ATOM,$time_end)); $diff = $start_date->diff($end_date,…
mpen
  • 272,448
  • 266
  • 850
  • 1,236
0
votes
0 answers

For Each Loop in Razor Page keeps sending the first row's data through

I am using a Functions class written in VB on my Razor Page. The page does what it is asked to do but the Next Date calculation is stuck on the first row. @page @model Moderate.Pages.DanceList.ThisCityModel @using VB_Stuff.VB_Stuff; Then I am…
JustJohn
  • 1,362
  • 2
  • 22
  • 44
0
votes
1 answer

Countdown the days and months within Postgres

I know of date_part('days', age(release_date)), which will show you days of the age of the release_date col (timestamp). For example, if the release date is 1994-05-30, the date_part calculation would yield 5 days. However, how can I find out from a…
I. Khan
  • 169
  • 6
0
votes
1 answer

Output most recent date Excel

I'm looking to derive a formula which will output the most recent date between cells CK:CM. My sheet looks like this: For row 2, output should be 2021-06-04, row 4 should be 2021-05-06, row 5 should be N/A. I'm currently using a nested IF statement…
0
votes
1 answer

Return number of days passed in current quarter

How can I get the number of days passed in the current quarter? For example, if today is 1/2/2021, it will return 2. If today is 2/5, it will return 36. If today is 4/2, it will return 2.
Judy
  • 3
  • 1
0
votes
0 answers

ORA-01858: a non-numeric character was found where a numeric was expected TRUNC(SYSDATE)+hour/24

I have a query which runs in sql developer as follows. UPDATE TEST_tbl SET FAIL_DT=TRUNC(SYSDATE)+08/24,UPDT_DT=SYSDATE, TXT='failed' WHERE SRC='srctest' when I try to implement the same query in jdbcTemplate with parameter I get the following…
Chak
  • 1
0
votes
2 answers

Convert INT INTO DATE to calculate AGE

I have a problem with a query on PostgreSQL. I have a case for school where I need calculate the age of a person when he register for school on 1st Septembre of 2005. In a file I have their date of birth and only the YEAR of school registration. The…
Jil0
  • 9
  • 2
0
votes
0 answers

What is the correct order for substracting from a date

I just stumbled on an interesting problem when trying to calculate birthday from age. Basically the idea is to substract a number of years, months and days from the current date. However depending on the order of subtraction eg smaller to larger…
Dobromir Velev
  • 530
  • 2
  • 15
0
votes
2 answers

Date Math in Reporting Services Expression

I'm trying to add days to a date and then compare to see if it's outside a range to color code a cell. It's not working--I think I may be making a simple syntax error. iif( (DateAdd("d", CInt(Fields!Days.Value), Fields!Date.Value) < Now), "Red",…
Jeff
  • 8,020
  • 34
  • 99
  • 157
0
votes
1 answer

Elastic relative data math - finding all things today

I'm trying to do so fairly simple query with Elasticsearch, but I don't think I understand what I'm doing wrong, so I'm posting here for some pointers. I have an elastic index where each document has a date like so: { // edited for brevity …
Chris Adams
  • 2,721
  • 5
  • 33
  • 45
0
votes
1 answer

Find most recent rows from one dataframe based on a second dataframe

I have two dataframes, dfburg and dfpolice. For each row in dfburg (a list of burglaries), I want to know what row in dfpolice (a list of police officer activities) was the most recent, and the row that occurred afterwards. The end goal is to see…
user13203033
  • 123
  • 7
1 2 3
8 9