Questions tagged [date-manipulation]
90 questions
0
votes
1 answer
Convert Sql Server stored procedure to Java
I'm migrating old reporting systems to a modern Java code base and stumbled upon Microsoft Sql Server stored procedure that generated table with dates (Year, Period, WeekStarting, WeekEnding). I need to migrate this code into Java and make it…

Maksim
- 16,635
- 27
- 94
- 135
0
votes
1 answer
Calculating next date for events
Im trying to build an application with recurring events.
In my database i have a table recurring_pattern:
type_name sepereation_count day_of_week week_of_month day_of_month month_of_year
daily 0 NULL NULL …

Leon
- 5
- 5
0
votes
5 answers
Why does Date::Calc complain about "not a valid date"?
Previously, this function worked for me...
$this_day = Day_of_Week($lyear, $month, $day);
using this lib..
use Date::Calc qw(Add_Delta_Days Day_of_Week Delta_Days);
But I need another way to get this same info.
the error it returned…

CheeseConQueso
- 5,831
- 29
- 93
- 126
0
votes
4 answers
How to use bash string formatting to reverse date format?
I have a lot of files that are named as: MM-DD-YYYY.pdf. I want to rename them as YYYY-MM-DD.pdf I’m sure there is some bash magic to do this. What is it?

jlconlin
- 14,206
- 22
- 72
- 105
0
votes
3 answers
Java current date minus 3 months and start from month begining
I need to get statistics for a quarter.
Example: today is February 10th 2018, I need to retrieve data from December 2017, from 1st to 31st, then from January 2018, from 1st to 30th and from February 1st to current date.
How can I achieve this using…

geass94
- 87
- 2
- 10
0
votes
2 answers
Crash on simple Date() manipulations in Swift
I got more and more crash-reports from apple (all on iPhone 5, iOS 10.3.3) on the following lines of code:
let date = NSDate()
var dateComponents = DateComponents()
dateComponents.hour = -6
let calculatedDate =…

tartsigam
- 71
- 1
- 5
0
votes
2 answers
Get the next time that respect a time format and not a pervious one
I am trying to get the time to the next "6:00:00", I am using moment:
let shiftEnd = moment("06:00:00", "HH:mm:ss")
console.log(shiftEnd.inspect())
It gets me the previous 6:00:00, the one with the same day as now().…

Assem
- 11,574
- 5
- 59
- 97
0
votes
1 answer
Using awk, how to convert dates to week and quarter?
Using awk, how to convert dates (yyyy-mm-dd) to week and quarter (first day of week set to monday)?
Input:
a;2016-04-25;10
b;2016-07-25;20
c;2016-10-25;30
d;2017-02-25;40
Wanted…

Markus
- 69
- 6
0
votes
2 answers
Sum and convert time to sec in MySQL
I have the time value in one column like below.
Now I need to sum this column and convert the result to minutes.

karthisena
- 19
- 7
0
votes
3 answers
Push strangely formatted dates into MySQL from PHP
I am sure this must be a common question but I cannot find it anywhere so here it goes:
I have dates in this format: 09/Jul/2003:00:03:48 -0300 and I want to push them into a DATETIME field in MySQL.
What is the easiest way to do this? Pushing…

sixtyfootersdude
- 25,859
- 43
- 145
- 213
0
votes
2 answers
Mysql, php query WHERE statement, recordset expire in +1 day of post date?
I basically have a simple calendar I set up. As of now, it shows "future" events. And then the event expires that day... I would love to find a WHERE statement that I can use to have that "event" stay up for 1 day past the "post_date"
(so if I post…

eberswine
- 1,224
- 3
- 20
- 39
0
votes
1 answer
Formatting a DateTime field in Perl
I am trying to use a string date, and format it to output correctly as "%Y%m%d_%H%M". Everything is outputting correct except for the day. It's actually returning the next day and I have no idea as to why it is. Below is the code and output.
my…

jamadri
- 926
- 3
- 17
- 32
0
votes
1 answer
Manipulating data using case when after when
I had a problem with date manipulation in SQL Oracle. Here's some code. Let's say I have 3 column
Create table anom1(
NAMEID, VARCHAR(20),
DATE_ENTRY, VARCHAR(20),
BIRTH DATE
)
and here's values of nameid, date_entry, and birth
INSERT INTO…

kyouzano
- 55
- 1
- 7
0
votes
1 answer
Discussion of `strtotime` problems eg "this x day " when day not = x gives NEXT x. ESOTERIC pls ignore
EDIT: Two minuses in under a minute. I thought this was a tiny but interesting query.
ORIGINAL QUERY: I am generating a five week calender into which I will pour info (the day and date and other stuff).
I want the top left cell to be the "current"…

BeNice
- 2,165
- 2
- 23
- 38
0
votes
2 answers
Get average interval between two dates PHP
So I have the following array ($lifeSpanArray) and I'm looking to calculate the average interval between the two dates.
What I have so far, but I think I'm thinking slightly wrong with it:

user2656127
- 655
- 3
- 15
- 31