Questions tagged [datetime]

A DateTime object in many programming languages describes a date and a time of day. It can express either an instant in time or a position on a calendar, depending on the context in which it is used and the specific implementation. This tag can be used for all date and time related issues.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
39 views

Create date in SQL [closed]

I have 'Year' and 'Month' column in my SQL table. No column for Day. Example below. Year Month 2010 10 2008 8 2021 11 Null Null 2009 2 I would like to create a 'Date' column (YYYY-MM-DD) where ...
user12501522's user avatar
0 votes
0 answers
13 views

Strange 7 minute shift when providing timezone information [duplicate]

Timezone-naive and -aware datetimes and conversion from/to timestamps give me big head aches from time to time. Just now I found a new strange behavior: datetime.datetime.fromtimestamp(pytz.timezone('...
M. Beining's user avatar
1 vote
1 answer
19 views

Changing row value based on previous row value

Exist a data frame with events start_ event end_event 1 2023-09-23 17:20 2023-09-23 17:40 2 2023-09-24 10:00 2023-09-24 10:20 3 2023-09-24 10:20 2023-09-24 10:40 4 2023-09-24 10:40 2023-09-24 11:...
GreatFilter's user avatar
0 votes
0 answers
38 views

Python pandas DataFrame value comparison

import pandas as pd from datetime import datetime data = { 'datetime_start': [ '2023-09-22 00:01:00', '2023-09-22 00:02:00', '2023-09-22 00:03:00', '2023-09-22 00:...
CodeByO's user avatar
0 votes
3 answers
54 views

DateTime formatting Month regardless of culture?

Can we format a DateTime in the following way based on the users windows culture... en-GB = 1st May 2023 en-US = May 1st 2023 without explicitly checking the CultureInfo and setting the format for ...
tinmac's user avatar
  • 2,369
0 votes
1 answer
21 views

Group by date then summarize and transpose data

I have a data set that looks like this: Date hh00 hh01 hh02 hh03 hh04 hh05 2021-09-01 21 0 51 12 65 96 2021-09-01 0 13 12 34 65 34 2021-09-03 12 0 0 1 61 96 2021-09-03 45 12 51 12 11 0 2021-09-...
Ryan Gary's user avatar
-1 votes
0 answers
36 views

c# DateTime comparison accuracy [closed]

In a unit test I have two DateTime objects which I want to assert on. I'm getting the failure message: Expected response.Data.DateTimeSince to be <2022-07-23 18:51:36.8558419>, but found <...
Stewart's user avatar
  • 17.7k
0 votes
0 answers
9 views

Writing a IBM-Cognos expression to filter dates between custom ranges

I'm trying to write an expression in Cognos Analytics to return my data points within a certain range. My data is organized similarly such as in this picture with dates and names all the way back to ...
Rararasputin9090's user avatar
1 vote
1 answer
22 views

Computation of index variable condtioned on datetime range touching two consecutive days

Toy data: df <- structure(list(datetime = structure(c(1692439200, 1692442800, 1692446400, 1692450000, 1692453600, 1692457200, 1692460800, 1692464400, ...
Pax's user avatar
  • 676
0 votes
0 answers
31 views

How to populate the amount received for each id based on the outstanding amount in given months

Below is the typical example of the dataset where I have Unique ID, Date and OS. OS is the outstanding loan amount at a particular month and the X1 (Out)~ X10(Out) is the output to be calculated for ...
Asit's user avatar
  • 9
0 votes
0 answers
19 views

How to detect Python datetime format strings that contain multiple format codes for the same component (month, day, etc.)?

datetime.datetime.strptime allows formats like "%b %m": >>> datetime.strptime('Oct 5', '%b %m') datetime.datetime(1900, 5, 1, 0, 0) While technically valid, this is confusing ...
user910210's user avatar
0 votes
1 answer
17 views

Converting UTC to CET. using base R [duplicate]

I am trying to convert '2023-02-04 01:00:00 UTC' to UTC+2. # create UTC date utc_date <- as.POSIXct( x = '2023-02-04 01:00:00', tz = 'UTC', usetz = TRUE ) # convert date format( utc_date, ...
Serkan's user avatar
  • 1,855
0 votes
1 answer
31 views

How to get the timezone offset for a specific timezone?

I need to sort cities based on their timezone (as TZ identifiers). To do so, the most natural way I found was to compare the offset of these timezones to UTC (but I am open to any solution). Date....
WoJ's user avatar
  • 27.3k
0 votes
1 answer
39 views

Laravel Eloquent MySQL DateTime field update with Interval gives an error

I'm trying to update DateTime fields for all records by adding 1 day using interval with eloquent like that TestModel::update(['date' => \DB::raw('DATE_ADD(date, INTERVAL 1 DAY)')]); But I'm ...
dgpro's user avatar
  • 347
1 vote
1 answer
29 views

Understanding Unix Timestamps and Time Zone Conversion in Python

I'm having trouble understanding Unix timestamps and time zone conversions in Python. I have a UTC datetime string ('2023-09-20T05:04:54') and latitude/longitude coordinates (around Toronto). I need ...
Qinghuan Li's user avatar
0 votes
1 answer
18 views

Slick 3.3.3 not parsing mysql datetime

Im using slick 3.3.3, and i have a table with columns setup with LocalDateTime (ive also tried OffsetDateTime) I was told slick 3.3.3 fixes the issue but no matter what I do i still get Text '2023-09-...
Mr. MonoChrome's user avatar
0 votes
2 answers
34 views

Filter datetime column between sunset and sunrise [closed]

I have a dataset that looks like this # A tibble: 24 × 3 datetime sunrise sunset <dttm> <dttm> <dttm> ...
Ryan Gary's user avatar
-1 votes
0 answers
56 views

Making composites from observational data with data gaps in time

Using numpy arrays, not pandas, is there a way to account for missing timesteps in my data and/or creating an array of Nans (len, len) then looping through my data and filling the array of Nans with ...
Mrose25's user avatar
  • 11
0 votes
2 answers
43 views

Printing a datetime, with timezone, but excluding the timezone name

I have a datetime object that I've created like so: dt = datetime(2023, 9, 18, 22, 30, 0, tzinfo=timezone(timedelta(hours=9))) This corresponds to September 18th, 2023 at 10:30PM JST. I want to print ...
Woody1193's user avatar
  • 7,316
0 votes
0 answers
36 views

DateTime conversion fails only in MERGE statement

I am running a procedure that transforms some data in a staging table and then merges it into the fact table. 2 of the columns are varchar as the data provider formats the datetime fields on export as ...
Colin-G-Davidson's user avatar
1 vote
1 answer
43 views

What is the best way to find frequency of data receival?

I'm trying to determine reporting period from a dataframe of reports. Options for reporting period would be: Monthly Quarterly Other The dataframe looks like this: data = [['F000003Y6H', '2018-07-31'...
shwe11's user avatar
  • 13
0 votes
1 answer
35 views

Stop parsing datetime.datetime to datetime64[ns] for pandas index

I want to set a pandas index with a datetime.datetime object. However, pandas always automatically parses this into its datetime64[ns] object while creating the index. As I later want to work with ...
Paul's user avatar
  • 3
0 votes
0 answers
12 views

How to set client machine datetime format for JavaScript date object [closed]

I need to set client machine datetime format to JavaScript Date object. (Need to show date with client machine datetime format) I am not able to find any solution, which returns date object with ...
Vinanti Yadav's user avatar
2 votes
2 answers
40 views

utc time string convert to Unix timestamp, and then convert back to utc date time string. But the result is not matched with the original one

I expect 'utc' and 'utc_str_back' should be the same time, but result is diferent. Here is the code: #input utc='2023-09-20T05:04:54' #calculation utc_time = datetime.strptime(utc, '%Y-%m-%dT%H:%M:%S'...
Qinghuan Li's user avatar
1 vote
2 answers
32 views

Select rows that meet a condition and occur for 10 consecutive seconds

I have some time series data below: Truck Timestamp b2_v_fult2_tms_err tm2_b_fault_level_a tm2_b_fault_code_a 0 251_EV01_PB_579_HD_756828 2023-05-01 13:11:48 ...
IDK's user avatar
  • 99
1 vote
2 answers
21 views

Resampling Partial Month to Full End of Month - Pandas

Putting this out there to see if there is a feasible solution for this. Suppose I have a volumes for every month that say looked liked : But if the start date for these volumes to be assigned is ...
Dark Knight's user avatar
2 votes
2 answers
50 views

Extract date from weirdly formatted datetime polars

import polars as pl df = pl.DataFrame(['2023-08-01T06:13:24.448409', '2023-08-01T07:29:34.491027']) print(df.with_columns(pl.col('column_0').str.strptime(pl.Date,'%Y-%m-%d'))) So I have the ...
INGl0R1AM0R1's user avatar
  • 1,554
-2 votes
0 answers
33 views

json serializing date time as milliseconds instead of date time in java 8 [closed]

Im using spring boot 2.6.6 and java 8. In a class A I have a field like private Map<String, List<Instant>> dates; While printing the values in map I’m getting: {DATE=[2022-03-18T21:00:00Z,...
siva's user avatar
  • 7
1 vote
2 answers
39 views

What is the maximum date python can store?

Using python datetime module: from datetime import date what is the farthest in the future I can go while being sure I won't break anything?
andyPity's user avatar
2 votes
1 answer
32 views

Joining Function outputs with existing columns as new variable

I'm looking to do a conversion from datetime/pandas date's storage system to the one SAS uses for the purpose of joining with a variable. Basically would like to go from this: ID date 101 20-01-01 ...
TDeramus's user avatar
  • 101
0 votes
1 answer
30 views

Hasura coversion of date time from date string

I have this select query as Native query in Hasura SELECT tblPhOrderSummary.Id as OrderId, tblPhOrderSummary.CreatedOn as OrderDate, tblItems.ItemCode as ItemCode, tblPhOrderProducts....
Nizal Sha's user avatar
-1 votes
0 answers
63 views

Input missing Date and Time data into a SQL Server table

I have a SQL Server table with Date and Time columns respectively. For each date entry there will 24 time entries as shown here: Date Time Value ----------------------------------- ...
SM079's user avatar
  • 410
0 votes
0 answers
13 views

Getting time If it is not visible or available on Page

I am looking for a way to get the time and date of the post using selenium Python of the publication of the posts. Problem is that date is not available on the page so I can't locate it using selenium....
Afaq 's user avatar
0 votes
1 answer
83 views

How do I show the current/live UK (time) using Javascript on my website

I have a script that I use to display and update the data/time live on a website. So I'll like the display the UK time that also updates when the time passes by not just as a static value. I'd like it ...
user1406440's user avatar
  • 1,339
0 votes
0 answers
17 views

Why ffmpeg didn't respond to custom name as output?

Working: import ffmpeg import os path = "K://Delete//" dir_list = os.listdir(path) for i in dir_list: ffmpeg.input(path+i).output("K://t//new%d.png", vf='fps=1/10').run() ...
pritam shasanee's user avatar
-1 votes
1 answer
17 views

How to Add a Real-Time Vertical Line to Shared X-Axis Plot in Plotly Python?

I'm using Plotly to create two time series plots, and I want to add a vertical dashed red line at the current time to both plots while sharing the same x-axis. However, when I use the 'fig.add_vline' ...
edge selcuk's user avatar
0 votes
1 answer
31 views

How to retain the time zone info when truncating a timestamp with time zone

TL;DR: How to select '1999-12-31 20:59:59+00:00'::timestamptz as truncated date-time information in a different time zone (without minutes and seconds, for instance), showing the time zone used, such ...
Jan Klan's user avatar
  • 677
-2 votes
2 answers
43 views

Time and Date based condition in Python [closed]

I have this code which returns Rate A or B based on time of the hour, I now want to add the date as an argument so Rates are A or B for 25/02/2023 and C or D for 26/02/2023 please: import numpy as np ...
Ashu's user avatar
  • 47
0 votes
1 answer
17 views

Remove the trailing time zone(UTC) in timestamp column in big query

Sep 14, 2023 @ 13:08:53.588 ( This is in string format in Bq column 'timestamp') and I have used the below code to convert it to timestamp SELECT PARSE_TIMESTAMP('%b %d, %Y @ %H:%M:%E*S',timestamp) ...
jay's user avatar
  • 3
-2 votes
0 answers
50 views

I need to determine how much days until my birthday:) [closed]

I found some posts here, but there are wrong and shows me -9432 , I already wrote program which determine it right, but I want to know more beautiful case to do it . Thanks DateTime birthday = new ...
Redcube_22's user avatar
0 votes
1 answer
16 views

Cannot coerce column to be the same date time type in R

> class(report_df$LASTACTIVITYDATE) [1] "POSIXct" "POSIXt" Because there are the mixed data types of POSIXct and POSIXt I cannot process my data correctly. Issue is happening ...
andrew ozbun's user avatar
-1 votes
0 answers
13 views

unsupported operand type(s) for -: 'datetime.datetime' and 'DeferredAttribute' [closed]

короче делаю приложения для отслеживание опозданий у меня есть модели employyee и attendance и я в модели employyee прописал функцию которая высчитывает от времени начало работы время прихода на ...
Улукман's user avatar
-2 votes
1 answer
83 views

How to make "it is the 10th day." format with date() of php? [closed]

I have a date object and want to show it as this format it is the 10th day. in my application. Fore example I want this it is the 10th day. to be dynamically generated. it is the 10th day. it is the ...
A47's user avatar
  • 23
1 vote
1 answer
34 views

Looking to reindex dates based on a groupby of Grid Cell

I am attempting to do something similar to the reindexing in Pandas reindex date index by group revisited except I have one extra level of indexing involved. My data is in the following structure: [...
arctic_climate_science's user avatar
0 votes
2 answers
24 views

Dealing with mixed format date-time data in R

I am reading data into R using read_excel. One of the columns date_time has a mixed format and is read in as a character vector. Here is a sample of the rows. date_time <- c( 45144.4762962963, ...
Mark's user avatar
  • 121
0 votes
0 answers
27 views

Grafana XAMPP Mysql Timezone issues with SUM

SELECT SUM(follow) AS 'FOLLOW', SUM(unfollow) AS 'UNFOLLOW', SUM(dm) AS 'DMs' FROM statistics.project_stats WHERE project_id = $projectName AND $__timeFilter(timestamp) I ...
Bella Smith's user avatar
0 votes
0 answers
17 views

When filling Excel dates with Python they cannot be sorted correctly

I have a python 3.9 script that I use to ask the user for information and dump it into an excel. One of the data that is requested from the user is a date, this must be shown in Excel in the first ...
Noob AF's user avatar
1 vote
1 answer
37 views

parsing timestamptz to consider a timezone

A rails 7 application defines config.time_zone = 'Vienna' config.active_record.default_timezone = :local A model has two attributes date, :timestamptz # date is just short for actual column ...
Jerome's user avatar
  • 5,607
1 vote
1 answer
66 views

Kotlin difference between two LocalDateTime

I have two kotlinx.datetime.LocalDateTime instances: val startDate = LocalDateTime(year = 2020, month = Month.MARCH, dayOfMonth = 25, hour = 10, minute = 36, second = 12) val endDate = LocalDateTime(...
MohammadBaqer's user avatar
0 votes
1 answer
40 views

Why does timezone unaware datetime object print out in local timezone?

When I instantiate a datetime object like this: >>> print(datetime.datetime.now()) 2023-09-16 10:30:15.50 I get the correct local time, which is currently around 10:30 AM. Why is it like ...
AlanSTACK's user avatar
  • 5,535

1
2 3 4 5
1409