date-arithmetic Questions

22

I have a table as follows: Filename - varchar Creation Date - Date format dd/mm/yyyy hh24:mi:ss Oldest cdr date - Date format dd/mm/yyyy hh24:mi:ss How can I calcuate the difference in hours min...
Tryst asked 8/7, 2009 at 8:39

44

Solved

I want a single number that represents the current date and time, like a Unix timestamp.
Glenine asked 21/10, 2008 at 9:29

7

Solved

I am trying to get the following in Postgres: select day_in_month(2); Expected output: 28 Is there any built-in way in Postgres to do that?
Lindsley asked 3/8, 2011 at 13:22

4

Solved

Using lubridate, how to calculate the last day of the previous quarter for a given date? The below formula doesn't seem to work for Nov 3rd, 2014 (other dates work) library(lubridate) date = as.PO...
Tinsel asked 19/11, 2014 at 11:33

9

I want to subtract 2 dates and represent the result in hour and minute in one decimal figure. I have the following table and I am doing it in this way but the result is not as desired. There is s...
Jaal asked 18/9, 2011 at 8:9

7

Solved

I have a table with 2 columns, date and score. It has at most 30 entries, for each of the last 30 days one. date score ----------------- 1.8.2010 19 2.8.2010 21 4.8.2010 14 7.8.2010 10 10.8.2010 ...

8

Solved

I am trying to sum INTERVAL. E.g. SELECT SUM(TIMESTAMP1 - TIMESTAMP2) FROM DUAL Is it possible to write a query that would work both on Oracle and SQL Server? If so, how? Edit: changed DATE to I...
Wildlife asked 28/7, 2010 at 10:43

17

I want a Java program that calculates days between two dates. Type the first date (German notation; with whitespaces: "dd mm yyyy") Type the second date. The program should calculates the number ...
Feints asked 23/11, 2013 at 17:31

19

Solved

I have two objects of DateTime, which need to find the duration of their difference, I have the following code but not sure how to continue it to get to the expected results as following: Example: ...
Missus asked 30/7, 2013 at 6:55

3

Solved

I'm looking for a way to get "tomorrow" and "the day after tomorrow" returned from a function that receives to dates: The current date: "2015/04/24 18:15:00" The date in the future: "2015...
Witkin asked 24/4, 2015 at 16:9

2

Solved

I have a field name textbook date field name NewMonth The data like this TextBook NewMonth ABC 2020-01-01 HDS 2020-01-30 ZXY 2020-02-15 FGD 2020-02-01 YTS 2020-04-02 HFH 2020-04-05 EDD 2020-03-...
Aswan asked 8/4, 2020 at 22:49

21

Solved

How do I tell the time difference in minutes between two datetime objects?
Leitman asked 28/8, 2009 at 9:3

4

Solved

I am using following to calculate age in timestamp difference. db.getCollection('person').aggregate( [ { $project: { item: 1, DOB: "$personal.DOB", dateDifference: { $subtract: [ new Date(),...
Tansy asked 8/9, 2016 at 1:56

1

Solved

Somebody asked this question as a comment in an answer I already posted to another question. Its awkward and confusing to have extra questions in comments, so I'm posting this as a new question. Th...
Rhonarhonchus asked 2/9, 2022 at 15:8

8

Solved

I have a date in R, e.g.: dt = as.Date('2010/03/17') I would like to subtract 2 years from this date, without worrying about leap years and such issues, getting as.Date('2008-03-17'). How would I ...
Lignocellulose asked 22/7, 2010 at 20:8

2

Solved

Below is the query I am running to get updates in last one hour. select count(*) from my_table where last_updated_date between to_date(to_char(sysdate,'YYYY-MM-DD HH24'))-1/24 and to_date(to_ch...
Elidiaelie asked 11/9, 2012 at 7:42

5

Example: seconds ="1015557"; Result should be: 11days 18h:05m:57s How can do this in MySQL?
Uncial asked 26/12, 2016 at 11:46

3

How do I add days to a timestamp? If my timestamp is 01-JAN-2011 11-09-05 and I add 2 days, I want 03-JAN-2011 11-09-05.
Weigela asked 26/5, 2011 at 17:51

9

Solved

I need a SQL statement to delete row that are older than 30 days. My table events has a field date that contains the date and the time it was inserted in the database. Will this work? SELECT * from...
Subdual asked 6/12, 2010 at 9:30

21

Solved

I'm looking to calculate the number of months between 2 date time fields. Is there a better way than getting the Unix timestamp and then dividing by 2 592 000 (seconds) and rounding up within MySQL...
Screamer asked 14/11, 2008 at 1:38

6

Solved

How could I convert a year-week (for example, 0852 or 200852) into a date (for example, 2008-12-31 or specifically a week-ending day, that is, Saturday 2008-12-27 or a week-beginning day, that is, ...
Unipolar asked 3/2, 2009 at 11:57

3

I have shift which is a datetime interval (a pair of datetimes). My weeks have a labeled partition (every week is the same: divided into parts, and each part has a label). I want to split up shift ...
Hemostat asked 27/10, 2019 at 11:36

3

Solved

I am not able to find any good conversion code to get 2014-02-17 into 2014-02-01 without having to use concatenation and a ton of formatting. I wonder if someone can help me find a good command to ...
Sulfathiazole asked 1/9, 2020 at 19:57

2

I am using below condition to truncate date in postgres to_date(to_char(trunc(appointment_date),'YYYYMMDD')||appointment_end_time,''YYYYMMDDHH24:MI:SS')AS tq How I can use this in postgres ?
Bonbon asked 28/1, 2021 at 4:59

2

I'm using a logistic exposure to calculate hatching success for bird nests. My data set is quite extensive and I have ~2,000 nests, each with a unique ID ("ClutchID). I need to calculate the number...
Anthropolatry asked 13/11, 2016 at 3:19

© 2022 - 2024 — McMap. All rights reserved.