# Questions tagged [time]

20097 questions

-2

votes

0

answer

22

Views

### ORACLE SQL - Show number of working hours between two dates

I'm trying to produce a report to show the number of working hours between 2 dates in Oracle SQL and have come a bit stuck so after help / advice.
In the report I have 4 columns:
- Job Logged (job.job_entry_date)
- Target on site (job.target_comp_date)
- Actual on site (job.actual_start_date)
- Jo...

0

votes

0

answer

8

Views

### How to stack columns of a time series data in python

I have a dataframe containing time series feature. In that, I would like to stack 5 features from this dataframe, each of shape(129,300).
to extract one feature alone I use:
Feature=df.iloc[:,start:end] #df is the dataframe containing the complete dataset
This retreives me that particular channel o...

-1

votes

2

answer

11

Views

### Modify datetime.now() standard output

I what to change standard time output to '%Y-%m-%dT%H:%M:%S.%f+00:00' format, how can I do it?
Here is what i have now.
import datetime
start_date = datetime.datetime.now()
print(start_date,'+00:00')
#output: 2019-04-19 06:57:47.563791 +00:00
#what to be: 2019-04-19T06:57:47.563791+00:00

1

votes

1

answer

20

Views

### Trouble finding understanding why complexity of two nested loops is O(n)?

So in the following code, j executes n times when i = 0. As soon as i iterates once (i = 0,2,3....n), j never executes, as the condition of the if statement is true and n is added to j. i continues to iterate until n which is when the loop (both loops) stop execution and the method ends.
public stat...

1

votes

1

answer

22

Views

### group by the count of how many successive days per id in pandas

If I have a pandas df like the following:
df = pd.DataFrame({ 'id':[1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,4,4],
'date':('2000-07-06','2000-07-07','2000-07-08','2000-07-09','2000-07-10','2000-07-06','2000-07-10','2000-07-11','2000-07-17','2000-07-20','2000-07-06','2000-07-07','2000-07-08','2000-07-10','...

1

votes

1

answer

47

Views

### How to calculate the steepness of a trend in python

I am using the regression slope as follows to calculate the steepness (slope) of the trend.
Scenario 1:
For example, consider I am using sales figures (x-axis: 1, 4, 6, 8, 10, 15) for 6 days (y-axis).
from sklearn.linear_model import LinearRegression
regressor = LinearRegression()
X = [[1], [4], [6]...

1

votes

3

answer

63

Views

### java.time.format.DateTimeParseException: Unable to obtain ZonedDateTime from TemporalAccessor on format ddMMyyyyhhmmss [duplicate]

This question already has an answer here:
Unable to obtain ZonedDateTime from TemporalAccessor when parsing a Date
2 answers
I'm having trouble in formatting a string to a ZonedDateTime.
My customer wants to have the date in a format such as ddMMyyyyhhmmss, with no separators or stuff like that....

1

votes

1

answer

43

Views

### How to check minimum and max times with LocalDateTime java ie minimum 10:00 and max time 10:30

I am new to java and I am having a problem with checking if a time falls/fits into a space of time, ie 10:00-10:30.
The idea is to find out if the time is between 10:00 and 10:30
below is my code:
LocalDateTime timecheck = LocalDate.now().atTime(10, 29);
if(timecheck.getHour() == 10 &&(timecheck.ge...

1

votes

2

answer

33

Views

### Anyone recognize this form for date storage?

I have values that came from a JSON blob and likely Excel before that.
There is a field for timestamp that includes values like these
timestamp = [
1519383511397, 1536864135321,
1540584502333, 1535641486675,
1541126656968, 1544634450352,
1538790352678, 1538171618112,
1546300725869, 1542642909566
]...

1

votes

1

answer

38

Views

### ggplot2 for monthly time series data

I have a time series like this one from 1979 to 2018
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1979 15.414 16.175 16.342 15.447 13.857 12.530 10.311 8.041 7.051 8.748 10.943 13.336
1980 14.862 15.955 16.041 15.429 13.793 12.205 10.100 7.984 7.667 9.183 11...

1

votes

3

answer

577

Views

### python how to -generate license- using time module [closed]

I'm searching for a way to generate a (limited time license) .so
when a user starts the program . it has to check license date first before the program runs.
but the problem is :
i tried a couple of solutions . one of them is python's time.ctime , (to check time and see if it's realy during the lice...

-1

votes

0

answer

23

Views

### How to create a loop on linear regression in Rstudio?

I have data that looks something like this, there is time series data for many Rute over multiple RASK.
Rute Year Month RASK Fare
A 2017 1 10 38
A 2017 2 9 37
A 2017 3 11 40
A 2017 4 12 42
B 2017 5 13 45
B 2017 6 1...

-1

votes

1

answer

25

Views

### How to Compare sort executions time unpredictable results in C

I am trying to write in file the execution time of the two bellow sorts (qsort & insertion) with giving them as parameters a random array. But the results each time of the second phase of clock() - clock() is 0 or something that doesn't seems right. For example if i have only the calculation of ins...

1

votes

3

answer

31

Views

### Find common ids against all dates python

I have two columns in a dataframe. ID and date. I want to find the IDs that are common for all given dates. There are a lot of ways/solutions to solve this problem. I'm wondering if there is a built-in function in python or pandas or numpy that can do the job for me. Let me show you by example:
Date...

-2

votes

1

answer

36

Views

### Time Diff Calculation

This is my data:
How can I calculate the time difference: so in this case it should be 08:26:00 ?
The column in 'Vrijeme'

1

votes

0

answer

12

Views

### how to convert axis time from “HH:mm:ss.000Z” to “HH:mm:ss” format

I have startTime field setter method which accepts only in org.apache.axis.types.Time and want to insert the time in 'hh:mm:ss' format. but when I try to insert the date in hh:mm:ss format, always it returns axis time with default format hh:mm:ss:SSSZ. I just need to remove the Z from SSSZ axis ti...

38

votes

2

answer

2.8k

Views

### Why does Java have support for time zone offsets with seconds precision?

On Wikipedia time zone offsets are explained as the difference in hours and minutes from standard UTC time. However, DateTimeFormatter supports zone-offset pattern XXXXX, which 'outputs the hour and minute and optional second, with a colon, such as '+01:30:15'.'
Are offsets like +01:30:15 ISO valid?...

1

votes

1

answer

414

Views

### Can't use variable in DateTime's modify() function. I'm getting an error: Object of class DateInterval could not be converted to string

I managed to dynamically load and compare several time values in PHP.
Right now I am stuck here:
$additional_time = $entry_start->diff($compare_from_timeformat);
$additional_time ->format('H:i');
$avaliabletime->modify('+1 hours');
I want to replace the +1 with $avaliabletime but if i try something...

1

votes

1

answer

2.5k

Views

### GoLang Time Formating and Converting from string

I'm quite new to Go and mainly work in C#. I am currently working on something that will be used as a command to get the next bus. Currently it does not compile because I am struggling with understanding how to use the time package in Go.
I have an array of strings formatted as times when it is sche...

5

votes

1

answer

55

Views

### Why Java has support for time zone offsets with seconds precision?

On Wikipedia time zone offsets are explained as difference in hours and minutes from standard UTC time. However, DateTimeFormatter supports pattern XXXXX which is explained as follows:
Offset X and x: This formats the offset based on the number of pattern
letters. One letter outputs just the hour, s...

1

votes

1

answer

2.6k

Views

### R: Deseasonalizing a time series

We can use following code to plot and decompose a time series in R:
# Monthly Airline Passenger Numbers 1949-1960
data(AirPassengers)
data = data.frame(AirPassengers)
data
#Transform to time series
ts.data1 = ts(data=as.vector(t(data['AirPassengers'])), start = c(1949), end = c(1960), frequency=12)...

1

votes

2

answer

200

Views

### How to find out all missing time slot(s) on a day

Is there any algorithms to find out all missing time slots on a day.
Given that there are four time slots which are selected.
e.g. Expected input: 08:00-1259, 13:45-17:15, 14:15-19:00, 20:00-23:33
I would like to find out all missing time slots based on the four time slots being selected with below...

1

votes

2

answer

4.1k

Views

### Converting timestamp to Calendar in Java [duplicate]

This question already has an answer here:
Convert Epoch seconds to date and time format in Java
5 answers
I want to get the year, month, date and hour from a long timestamp value. I found many examples of creating a Calendar from a timestamp value, but I don't get what I want.
I wrote the followin...

0

votes

1

answer

143

Views

### Possibility of updating data in real-time on a client

I have the following scenario that I was wondering if it's possible/feasible to implement. I apologize if this is considered an overly 'broad' question, but I think SO would be the best place to ask this.
Let us suppose I have a website and I want to display a graph to an end-user. For the purposes...

1

votes

2

answer

2.8k

Views

### Check if time is the same with Moment.js

How to check if time is the same for Moment objects with different dates?
For example I have object like
const endDate = moment().add(30, 'days').endOf('day');
and I want to check if some moment object is endOf day.
private isEndOfDay(dateTime: string) {
const m = moment().endOf('day');
return m.is...

1

votes

2

answer

736

Views

### Why is Postgres query faster than Redis query?

I am learning about Redis, and how its blazing fast since its an in-memory database. In my Django application, I have a Postgres table with about 1500 rows in it. The model only has two fields 'name' and 'occurrence'. To test out how much faster it would be to query for objects out of memory, compar...

1

votes

2

answer

33

Views

### Query a time that is less than a specific one

I need to query a time that is less than 10 seconds.
I have this table :
CREATE TABLE Results(
id_result SERIAL PRIMARY KEY,
score REAL,
temps TIME );
Thank you

1

votes

2

answer

63

Views

### How to limit concurrent access to a single real-time resource

I'm trying to identify or understand an appropriate technique, idiom, whatever for a specific concurrent programming problem I'm having.
For simplicity's sake, assume I have a real-time graphical user interface (UI) that is redrawn on screen at 10Hz always and forever.
I would like to display a 'Bu...

1

votes

2

answer

215

Views

### Convert timestamp to ISO format in golang

I'm trying to convert the timestamp 2018-12-17T15:03:49.000+0000 to ISO format in golang, but am getting an error cannot parse '+0000' as 'Z07:00'
This is what I tried
ts, err := time.Parse(time.RFC3339, currentTime)
Any ideas?

1

votes

3

answer

42

Views

### R ggplot time series without grid arrange

I have a different time series for example 4. In this case, I simulated 4 white noise time series.
timeSeries

1

votes

2

answer

69

Views

### Time Complexity for binary permutation representation of n bits

I have return a below code in java to produce the possible binary representation of n digits.
public List binaryRepresenation(int n){
List list = new ArrayList();
if(n>0){
permuation(n, list, '');
}
return list;
}
private void permuation(int n, List list, String str){
if(n==0){
list.add(str);
}else{...

1

votes

1

answer

46

Views

### Javascript - How is this clock function updating time if there is no setInterval function?

I thought that startTime is only called once and so is setTimeout. Why doesn't this need setInterval instead?
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
m = checkTime(m);
s = checkTime(s);
document.getElementById('...

1

votes

1

answer

425

Views

### What is the Search/Prediction Time Complexity of Logistic Regression?

I am looking into the time complexities of Machine Learning Algorithms and I cannot find what is the time complexity of Logistic Regression for predicting a new input. I have read that for Classification is O(c*d) c-beeing the number of classes, d-beeing the number of dimensions and I know that for...

1

votes

5

answer

61

Views

### I want to combine two variables into one with a date format

I have a data set with a character column for months (MONTH) and a numeric column indicating years (YEAR). In order to work with it as panel data, I need to unite these YEAR and MONTH into a variable with a date format.
I have tried to change the variable MONTH to numeric format and then to merge MO...

1

votes

2

answer

29

Views

### How do I filter down a subset of files based upon time?

Let's assume I have done lots of work whittling down a list of files in a directory down to the 10 files that I am interested in. There were hundreds of files, and I have finally found the ones I need.
I can either pipe out the results of this (piping from ls), or I can say I have an array of those...

1

votes

1

answer

43

Views

### Constant value of __TIME__ in whole program [duplicate]

This question already has an answer here:
C++ __TIME__ is different when called from different files
3 answers
If I have a C program consisting of multiple C source files that each use the preprocessor directives __DATE__ and __TIME__, is there any way I can make sure that the value is always the s...

1

votes

2

answer

40

Views

### Time complexity of divide and conquer relation

I was trying two calculate the time complexity of below function.
I tried two different methods
1) Since nearly every time there will be two recursive calls .
we can write the recurrence relation as T(n)=2T(n/2)+c.
which gives us O(logn).
2)But we can say also say that total number of recursive ca...

1

votes

2

answer

55

Views

### Determining Time Complexity of a Recursive Function Calling From inside a Loop

I am not sure, is that question previously asked in SO or not. Well, I was checking frequency of a char in an array. I am pretty weak in determining complexity, so I thought this community can help me to get the point! I am very much sorry, if I posting it with some abstraction! If anyone can help m...

1

votes

3

answer

68

Views

### Getting java.time.DateTimeException when formatting LocalDateTime instance with Locale

This is not clear to me. For some reason when I am trying to format LocalDateTime instance using DateTimeFormatter.ofLocalizedDateTime(FormatStyle.LONG).withLocale(...), I am getting an exception:
java.time.DateTimeException: Unable to extract value: class
java.time.LocalDateTime
It happens only if...

0

votes

0

answer

12

Views

### How to deal with NA's after converting a factor column to date format in a dataset

I have this data, i converted it into date format,
Period Product.Group Amount
7 Jan-16 ADSL 150936
9 Jan-16 Data 31534
10 Jan-16 Internet 57086
11 Jan-16 Ka Band 15421
12 Jan-16 Postpaid Voice 1172139
25 Feb-16 ADSL 57870
26 Feb-...