Questions tagged [datetime]

22624 questions
1

votes
1

answer
1.4k

Views

phpspreadsheet German date format

How can i set the german date format with phpspreadsheet? If i set the cell to ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY) it will be displayed in Excel to Screenshot Excel date format 1 If i use ->setFormatCode(\PhpOffice\PhpSpreadsheet\StyleNumberFormat::FOR...
awekas
2

votes
0

answer
10

Views

Generate complete iso date time representation strings with fraction and timezone

I want to print an ISO 8601 conforming string of the form of the complete date time representation as in ISO 4.3.2 Complete representations 1985-04-12T10:15:30Z combined with 4.2.2.4 Representations with decimal fraction as 23:20:50,5 combined as allowed in 4.3.3 Representations other t...
Superlokkus
1

votes
3

answer
36

Views

How to loop two DateTime by minutes? JavaScript

var start = '13.04.2019 10:00:00'; var end = '14.04.2019 16:00:00'; I need to loop minute by minute. please help me. // var start = '13.04.2019 10:00:00'; // var end = '14.04.2019 16:00:00'; var start = new Date(2019,05,13,11,00,00,00); var end = new Date(2019,05,14,16,00,00,00); var loop = start; w...
Mizhar Raja
1

votes
1

answer
138

Views

Apache Nifi Expression Language - toDate formatting

I am trying to format a date string using the Apache Nifi expression language and the Replace Text processor(regex). Given a date string date_str : '2018-12-05T11:44:39.717+01:00', I wish to convert this to: correct_mod_date_str: '2018-12-05 10:44:39.717', (notice how the date is converted to UTC,...
irrelevantUser
1

votes
3

answer
60

Views

PHP Display Date Time with Offset

In php how can I display the current date and time with the timezone offset such as this: date_default_timezone_set('America/Denver'); $now = new \DateTime('NOW'); echo $now->format('Y-m-d h:i:s'); // This displays 2019-01-09 19:30:19 but I want it to display 2019-01-09 07:00:00 because I am in M...
LargeTuna
1

votes
1

answer
45

Views

Opposite function to utcfromtimestamp?

What is the opposite function to utcfromtimestamp()? timestamp() apparently does not take the timezone into account, as one can see in the following example: import pandas as pd import datetime start = pd.datetime(2000, 1, 1, 0, 0, 0) asFloat = start.timestamp() startDifferent = datetime.datetime.ut...
user7468395
1

votes
2

answer
27

Views

Calculating time delta of users

I have user session ids and the timestamp of the session ids where some event occurs. I want to calculate the time between the first event and the last event. Please see the example below: session_id timestamp sess1 2018-11-05 14:28:25.260 sess2 2018-11-04 12:14:59.576 sess2 2...
Nofy
1

votes
1

answer
37

Views

How to fix hh:mm format

I have an Excel file imported from a specific information system. I have been working with its automation through VBA code. However i encountered a problem while dealing with hh:mm cells. I can't sum them up, I tried formatting them to hh:mm, I also tried to format my output cell as [HH]:MM, none of...
Yassine Lachgar
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....
Gianmarco F.
1

votes
1

answer
33

Views

How can format date to French value in RobotFramework?

Is it possible set a Local to Convert Date in Robotframework? ${today}= Get Time ${today_s}= Convert Date ${today} result_format=%A %d %B Thursday 04 April but i need Mardi 04 Avril EDIT with a workaround: *** Settings *** Library SeleniumLibrary Library Collections *** Variables *** &{d...
sgrillon
1

votes
1

answer
28

Views

Pandas: Select last dates from cut-off level

I have a list of dates and a cut-off level: 31st of March. I want to look at the first date before 31st of March and make that the last date in the year and then select the last 3 before and put them into 1 year. (E.g: If we look at 1997, the first date before March 1997, is: index 8, date: 1996-12-...
Adrian
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...
Musa
1

votes
3

answer
93

Views

How to sort lists of objects using java

I have 2 lists which are holding the same objects but unordered and I want to sort them first before comparing them in order to check whether they are equals. One item of each list looks like that: first list: AuditRow{dateStr='2019-04-15 11:16', userStr='admin', entityStr='Users'} second list: Aud...
tupac shakur
1

votes
1

answer
23

Views

Converting a string to an xs:dateTime

How do I convert Strings of the form 'Sun Feb 25 19:31:07 +0000 2018' to xs:dateTime in XQuery? Maybe first converting the String into an ISO 8601 datetime format?
Johannes
1

votes
2

answer
27

Views

Find Difference in minutes between two columns based on matching first two characters

I have this dataframe, I am trying to find the difference in minutes between Date1 and Date2 IF the first two characters are the same and create a column for that. For example, the first row, 22 = 22 so then find the difference between 20:27:45 and 20:52:03 Date1 Date2 ID City 0 22...
TH14
1

votes
1

answer
36

Views

Python convert date format to datetime accurately which includes dates before 1970

Consider python panda code as datetest = pd.DataFrame({'year':['02','08',23,32,43,68,70,72,85,94]}) newdate = pd.to_datetime(datetest['year'], format='%y') print(newdate) Output: 0 2002-01-01 1 2008-01-01 2 2023-01-01 3 2032-01-01 4 2043-01-01 5 2068-01-01 6 1970-01-01 7 1972-01-01 8...
Jayant
1

votes
2

answer
21

Views

Python Datetime with sequential issue

I am trying to write a script, where 3 variable of the list. at first, see my current script: import datetime as dt import pandas as pd x = ['jhon doe', 'GX'] y = ['donald ted', 'GY'] Z = ['smith joe', 'GZ'] start_date = dt.datetime(2019, 4,12) end_date = dt.datetime(2019, 4,21) daterange = pd.date_...
newcoder
1

votes
3

answer
38

Views

Convert YYYYMMDD into YYYY-MM-DD and HHMMSS into HH:MM:SS for candlestick plotting

I've been trying to find an answer for 4 hours, but no luck. Any help will be very appreciable. Goal: convert 20170103 into 2017-01-03 and 022100 into 02:21:00 for candlestick plotting date_int = 20170103 df = pd.DataFrame({'date':[date_int]*10}) df['date'] = df['date'].apply(lambda x: pd.to_datetim...
mocs
1

votes
1

answer
29

Views

T-SQL: DateTme Column varchar cast that may contain '1753-01-01' to empty string

Task: convert a DateTme column (cast as varchar) that may contain 1753-01-01 to an empty string. What is the most efficient way to do this in T-SQL? For example, if I use: SELECT LEFT(CONVERT(VARCHAR, DateCol1, 120), 10) FROM ourDatabase.dbo.ourTable How can I efficiently change any row containing...
JosephDoggie
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...
Moayyad Yaghi
1

votes
0

answer
10

Views

Adding rows for each month in a dataframe based on column date

I am dealing with financial data which i need to extrapolate for different months. Here is my dataframe: invoice_id,date_from,date_to 30492,2019-02-04,2019-09-18 I want to break this up for different months between date_from and date_to. Hence i need to add rows for each month with month starting da...
Prasanna
1

votes
2

answer
2k

Views

INSERT statement with 'now() + INTERVAL' inserts 000's in PDO with named placeholders

I'm having trouble converting this now() + INTERVAL INSERT statement to a PDO prepared statement with named placeholders. When I bind the value using either 'now() + INTERVAL 3 DAY' or 'DATE_ADD(now(), INTERVAL 3 DAY)', it inserts 000's instead of the correct datetime (0000-00-00 00:00:00) This is...
Chaya Cooper
0

votes
1

answer
28

Views

How to subtract time using PHP?

I am trying to subtract one array to another array. but this is related to time. I am unable to produce expected output. Simply I just want to remove 2nd array overlap time slot from the first array. I have the following array as an example $array1 = [ 0 => [ 'start_hours' => 9, 'start_minute' => 0...
Faisal
0

votes
1

answer
18

Views

Find the total number of working days in between two days, excluding holidays

I have two dates, for example: import datetime start_date = datetime.datetime.today().date() end_date = start_date + datetime.timedelta(days=30) Now considering I have a holiday tomorrow, how to find out the total number of working days. Working days are the days excluding saturday and sunday. Thank...
DevOps
1

votes
6

answer
7k

Views

How to set time to Zeros in DateTime?

Lets say I have the following DateTime variable DateTime CurDate = '26/3/2014 12:00:00 AM'; I'm wondering how can I set the CurDate so that the value will become 26/3/2014 00:00:00 AM Note that I still want the time, but with all zeros. **P/S: The reason for having all zeros is because the datetime...
Isaac Lem
1

votes
1

answer
337

Views

How to prevent insertion of invalid dates into a SQLite table?

SQLite tables can't have a column of type date or timestamp. Dates are stored as either text or a number. That being the case: How can I prevent an invalid date like February 31st from being inserted into a table? I'm know you can validate the date in the application before inserting, but that's no...
Tulains Córdova
1

votes
2

answer
718

Views

How to parse Timezone Offset string?

I retrieve a value from my database of a timeZone offset. The value that I get is in time. For example, it could be '-5:00', '+7:30', '+3:00', etc. How do I convert that to a double so I can do an AddHours() call on a DateTime object?
rmh
1

votes
1

answer
492

Views

Multiple language datetime text to standard date format [closed]

I'm using dateutil.parser.parse in Python to standardize dates. Not all of the dates are in English. Therefore, the standardization process failed with 'unknown string format' error. Is there a way to process such dates or at least avoid the error? Sample date formats: Wed, 17 Oct 2001 11:49:53 -070...
Naveen Mathew
0

votes
1

answer
48

Views

How to combine dates and times?

I want to add a time to a datetime. My initial datetime is: initial_datetime='2015-11-03 08:05:22' and is a string and this_hour and this_min are strings too. I use: time='-7:00' time = time.split(':') this_hour = time[0] this_min = time[1] initial_datetime='2015-11-03 08:05:22' new_date = datetime...
Torb
1

votes
1

answer
1.6k

Views

Date pattern in arabic

hello guys I have a web service that returns the date as a string ex: 2016-4-10. my android application is bilingual (Arabic and English), when it's in English I;m able to transform the date into the following pattern Tuesday, September 2016 but I'm failing in changing it when in Arabic to: الثل...
eshteghel company
1

votes
2

answer
1.2k

Views

Cannot implicitly convert DateTime to Timespan

Sql Server has the variable TEST_TIME data type as Time(7) I created the tables in C# and it automatically assigned the Timespan datatype. Now, i'm trying to upload csv file data to the SQL database and it is giving me an error ' Cannot implicitly convert DateTime to Timespan'. What would be the bes...
SQLserving
0

votes
0

answer
5

Views

How to reindex a dataframe using two datetime variables that define a duration

I am trying to reindex my dataframe that has two datetime variables which define the duration. I want my dataframe to be indexed by one datetime variable incrementing by 1 minute with missing values/strings where there is no observation. My data looks something like this DMS = pandas.DataFrame({ 'ID...
Sher Afghan
1

votes
3

answer
1k

Views

Unable to sort date time in javascript with format dd/MM/yyyy HH:mm

I am not able to sort by latest date time in javascript. Below is my json : let jsonStr = [{id:1,date:'04/04/2017 17:47'}, {id:2,date:'05/01/2015 12:35'}, {id:3,date:'31/02/2017 10:00'}, {id:4,date:'31/02/2017 12:00'}]; Expected result : Latest date time should be first in the list 04/04/2017 17:47...
Siddharth_Vyas
1

votes
2

answer
641

Views

PythonNET DateTime C# .NET List how to populate it?

I can't find any answers out there for PythonNET working with Lists, a package for Python that lets you import .NET DLLs. For some reason creating a list of DateTime was not working for me. SOLVED Here's how to make it work: import clr from pandas import to_datetime, Series from System.Collection...
Matt
1

votes
1

answer
9.3k

Views

Matplotlib dates in datetime format

I am plotting a candlestick chart (ohlc+volume) and unfortunately I can't figure out how to display the date in datetime format. Several approaches did not work. import matplotlib.pyplot as plt from matplotlib.finance import candlestick_ohlc from matplotlib import style import pandas as pd style.use...
saitam
3

votes
4

answer
82

Views

Get previous number in loop when saved to variable

still new to learning JavaScript. I want to loop through some values. If value is greater or equal to a certain number, then break the loop and get the previous number. For example: var time = [14, 35]; var interval = 40; // in minutes var startTime = [10, 40]; var timeFormatted = '2019-02-04 '+t...
pixie123
1

votes
2

answer
892

Views

How to inject Docker container build timestamp in container?

I would like to build a container which shows up in its startup log its build datetime. Is there a way to have that information injected from my build machine into the container ?
Riduidel
1

votes
3

answer
53

Views

Oracle: local Timezone, differentiate double hour 2

I have an Oracle-table (MYTAB) with a columns for a datetime (MYDT) and a value (MYVAL). MYDT NOT NULL TIMESTAMP(0) WITH LOCAL TIME ZONE MYVAL NOT NULL NUMBER Lets have a look the the switch of the timezone CEST to CET. Every last Sunday in October there is a double hour 2 for localti...
chris01
1

votes
2

answer
279

Views

Plotting Time and float value using python matplotlib from File

I am having a text file with time and a float value. I have heard that it is possible to plot these two columns using matplotlib. Searched similar threads but could not make it happening. My code and Data are- import math import datetime import matplotlib import matplotlib.pyplot as plt import csv w...
Pratik
1

votes
3

answer
153

Views

PHP Time Comparison Is Failing

I'm working on a Wordpress plugin and having problems with a time comparison. I basically want: if selected time is before current time, do the thing... but it's not working. The validation is failing if expire is less than five hours ahead of the time(). I correct this by adding the gmt offset expi...
Sal Cangeloso

View additional questions