C# : Converting a timestamp to a DateTime, then back to a timestamp gives different values

I have a huge text file of entries, all of which have a timestamp. These entries are read and the timestamp on each entry is converted to a DateTime. The problem is that the timestamps are different if the DateTime objects are converted back, this is causing a problem with false duplicates and generally a… Read More C# : Converting a timestamp to a DateTime, then back to a timestamp gives different values

Select the dataframe based on the certain time value in pandas

I have a dataframe df = pd.DataFrame([["A","11:40 AM"],["B","12:51 PM"],["C","6:33 PM"],["D","11:13 AM"],["E","7:13 PM"]],columns=["id","time"]) id time A 11:40 AM B 12:51 PM C 6:33 PM D 11:13 AM E 7:13 PM I want to select only those rows which are < 6:30 PM. Expected output: df = pd.DataFrame([["A","11:40 AM"],["B","12:51 PM"],["D","11:13 AM"]],columns=["id","time"]) id time A 11:40 AM B… Read More Select the dataframe based on the certain time value in pandas

Unix get lines between timestamps on multiple files

I keep daily log files (like logfile-2022-01-01.log, logfile-2022-01-02.log, and so on). Every line on the files starts with a timestamp, e.g: [2022-05-01 10:00:34.550] …some strings…. –> this being YYYY-MM-DD HH:MM:SS.sss I need to filter all the lines between two timestamps, this could mean search in more than one file. For instance: logfile-2022-01-01.log [2022-01-01 00:00:25.550] here… Read More Unix get lines between timestamps on multiple files

SQL – Creating UTC Timestamp from separate date/time/timezone information

I’m working with BigQuery and have a table that looks like: YEAR MONTH DAY timezone local time 2015 6 24 America/Los Angeles 1930 Where local time is given by hhmm. I’m wondering if I can format this information into a timestamp column in SQL that yields time in UTC. I know I can use `TO_TIMESTAMP`… Read More SQL – Creating UTC Timestamp from separate date/time/timezone information

Pandas groupby user and count number of events between 2 timestamps

I have a DF1 where each row represents an "event". Each event has the columns "user", and "time": DF1: "user","time" user1,2022-11-14 00:00:04 user2,2022-11-16 21:34:45 user1,2022-11-14 00:15:22 user3,2022-11-17 15:32:25 … The "time" value is any timestamp in one week: from 2022-11-14 and 2022-11-20. There are 10k different users, and 27M events. I have to divide the… Read More Pandas groupby user and count number of events between 2 timestamps

PostgreSQL: format timestamp with T delimiter between time and date

What I expect: SELECT to_char(current_timestamp AT TIME ZONE ‘UTC’, ‘YYYY-MM-DDTHH24-MI-SS’) to produce: 2022-11-11T11-29-51 But it produces: I’ve tried several options, but neither of them does the trick: Query for convenience: SELECT to_char(current_timestamp AT TIME ZONE ‘UTC’, ‘YYYY-MM-DDTHH24-MI-SS’) as plain, to_char(current_timestamp AT TIME ZONE ‘UTC’, E’YYYY-MM-DD\’T\’HH24-MI-SS’) as with_quotes, to_char(current_timestamp AT TIME ZONE ‘UTC’, ‘YYYY-MM-DD\THH24-MI-SS’) as with_backslash,… Read More PostgreSQL: format timestamp with T delimiter between time and date