Questions tagged [date-manipulation]
90 questions
1
vote
3 answers
How to get the next n fridays which are the first, second or third friday in a month?
I need to find the next n Fridays but want to exclude 4th and possibly 5th Fridays, i.e I want to get the next n Fridays which are 1st, 2nd or 3rd of each month. I have found a way to stream over the next n Fridays (example next 10…

wannaBeDev
- 516
- 3
- 14
1
vote
1 answer
Mutate and format multiple date columns
I have a tibble containing some date columns formatted as strings:
library(tidyverse)
df<-tibble(dates1 = c("2020-08-03T00:00:00.000Z", "2020-08-03T00:00:00.000Z"),
dates2 = c("2020-08-05T00:00:00.000Z", "2020-08-05T00:00:00.000Z"))
I…

Simon
- 991
- 8
- 30
1
vote
1 answer
calculate 3 months after the date - Android
I want to calculate 4 months after the date I pulled from the database. How can I do that. The output of history is as follows.
Wed Nov 27 14:42:23 GMT+03:00 2019
JSONObject form_tarih2 = jObj.getJSONObject("form_tarih2");
String date =…

berkoberkonew
- 77
- 1
- 8
1
vote
2 answers
Perl Date::Manip detects timezone wrong for EST and EDT
I have the server where system timezone is EST
It was set with
# timedatectl set-timezone EST
# timedatectl
Local time: Tue 2019-06-18 03:29:42 EST
Universal time: Tue 2019-06-18 08:29:42 UTC
RTC time: Tue 2019-06-18 08:29:42
Time…

Roman Gelembjuk
- 1,797
- 2
- 25
- 50
1
vote
2 answers
How to get the next date which is a fraction year away from the given date?
I have a datetime object called dt and I want to get the next date which 0.93 years away from it. I was trying relativedelta but it seems that the function cannot take fractional years.
dt = datetime.datetime(2012, 4, 30)
dt + relativedelta(years =…

Sheikh Sadik
- 37
- 5
1
vote
1 answer
Adding dates in javascript with unexpected results
I am trying to loop over and add 7 days to the date, and I am not sure where I am going wrong. The dates get crazy after the first iteration of the loop.
What I am trying to achieve is Jan 1 next day is jan 8 then jan 8 and jan 15 etc. Its…

user3525290
- 1,557
- 2
- 20
- 47
1
vote
2 answers
SQL Server 2008- If date falls on weekend, Increase to next Monday
In SQL Server I am calculating a date based on certain business rules. If the date falls on a weekend I need to move it up to the next monday...so basically:
if(date == saturday)
{
add 2 days
}
if(date == sunday)
{
add 2 day
}
What is the…

stephen776
- 9,134
- 15
- 74
- 123
1
vote
0 answers
Query that connects Year and Month into a single column where dates are timestamped (SQL Server 2008)
I have a table where the values in the date column are represented like this
2018-01-22 11:26:28.000
I run the following query in order to group the sums given the month/ year:
select
sum(number) as 'Number',
month(Datetime) as 'Month',
…

nunga
- 31
- 5
1
vote
1 answer
Automatic time stamp auto-change to the date of my next weekly meeting
I have a Google Sheet for a weekly meeting. I currently have Column A automatically filling the date of when I enter anything into the box in Column B. Since I typically put the date of the next meeting, not the date I add the note, I wondered if…

emmalo
- 35
- 3
1
vote
3 answers
Convert Ticks to TimeSpan
I want to convert Ticks to TimeSpan.
I need a ConvertToTimeSpan function like below.
var ticks = 10000;
TimeSpan ts = ConvertToTimeSpan(ticks); // not working
Console.WriteLine(ts); // expected output --> {00:00:00.0010000}

kame
- 20,848
- 33
- 104
- 159
1
vote
2 answers
How can I calculate dates in jQuery, and set an input date's value to that?
I have this html:
Which sets…

B. Clay Shannon-B. Crow Raven
- 8,547
- 144
- 472
- 862
1
vote
1 answer
Convert Number to Date in SQL Server with Exception in Month-End
I have an INT column in my table. This column stores the date in special format. I'm trying to convert that column to DATE type.
For example, we keep '2016-03-14' as 20160314.
The exception is, for the last of each month, we do not store day.
So…

FLICKER
- 6,439
- 4
- 45
- 75
1
vote
3 answers
add days and hours in date/time field and get the updated date/time in php using mysql
I would like to provide the ability for users to submit a datetime value, along with values representing additional days/hours, and then store the datetime that results from adding the two in a mysql database.

rajson007
- 21
- 1
- 3
1
vote
1 answer
How to avoid expensive Cartesian product using row generator
I'm working on a query (Oracle 11g) that does a lot of date manipulation. Using a row generator, I'm examining each date within a range of dates for each record in another table. Through another query, I know that my row generator needs to generate…

earachefl
- 1,880
- 7
- 31
- 55
1
vote
3 answers
Why do I get “uninitialized value” warnings when I use Date::Manip’s UnixDate in a sort block?
Related/possible duplicate: Why do I get "uninitialized value" warnings when I use Date::Manip's sortByLength?
This block of code:
my @sorted_models = sort {
UnixDate($a->{'year'}, "%o") <=>
UnixDate($b->{'year'}, "%o")
} values…

Kys
- 2,597
- 5
- 20
- 16