Most voted "datetime" questions
A Datetime object in many programming languages describes a date and an hour of the 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 application. This tag can be used for any question related to date and time.
Learn more…440 questions
Sort by count of
-
1
votes1
answer42
viewsCheck 2 values after . (point)
I am developing a code where I have to calculate daily parking. In case the user selects for example: From: 05-11-2015 15:00 Until 06-11-2015 15:00 The value to be returned is 1, that is, 1 night.…
-
1
votes1
answer459
viewsHow can I set the time pattern as UTC or GMT in PHP?
Several systems, large sites when it is possible to inform the time they ask for the choice of UTC or GMT. I tried this in PHP, but I was not successful using default_date_timezone_set(), how can I…
-
1
votes1
answer1233
viewsAdd days on increasing date via For
In the code below I add 1 to each step in the variable i, to add 30 days in the field dt, I need another for or you can do it yourself? DbConnection cnx = ADO_Utils.GetConnection(); DbCommand cmd =…
-
1
votes1
answer4608
viewsHow to compare a date of type datetime?
I have a date in a patient table in the Sql Server database in the following format: datetime (01/01/2016 12:50:00.000) I want to check if the patient’s appointment time has arrived. For example:…
-
1
votes1
answer122
viewsSimpleformatdata returning null HH:mm:ss
I need to take only the time informed by the user, but the method I did returns null when I try to change the format to HH:mm:ss public static Date formataData(String data) throws Exception { if…
-
1
votes1
answer808
viewsFormat dates in sql
I have a program in c# (Visual Studio) of registration that contains a textbox to receive a date. Knowing that SQL records the date in American format, how can I make the user to enter the date in…
-
1
votes2
answers99
viewsWhat is the correct way to choose column types?
I always see tables as follows. Ex: CREATE TABLE posts ( id int(11) NOT NULL, titulo varchar(255) NOT NULL, autor varchar(255) NOT NULL, conteudo text NOT NULL, data varchar(11) NULL, )…
-
1
votes1
answer55
viewsServer with intermittent time
I have an external PHP server that has generated some time problems, sometimes it generates the correct time (eg: generates 17:00 to 17:00) and other times it generates with two more hours (ex:…
-
1
votes1
answer69
viewsTimespan: count occurrences at a specific time
How could I assemble this method that counts the occurrences of a specific set of times in a period? public static int OcorrenciasDeHorarios( DateTime Inicio, DateTime Final, params string[]…
-
1
votes0
answers58
viewsFormatting Date Time
I have a field in the Datahora database, my class is simple and has no Annotation public DateTime DataHora { get; set; } i have these two fields on the screen for the user who will use a single…
-
1
votes1
answer518
viewsCompare dates in an array?
In the date variable, you are receiving several dates in string as array, want to bring the smallest cont = 0 menor_data = datetime.strptime('31/12/2300', '%d/%m/%Y') while cont < len(datas):…
-
1
votes1
answer2049
viewsHow to display date and time "at runtime"?
I would like to know how to display the current date and time of the computer, and the time should be updated at runtime. I thought of passing an object to a label, but it did not. I’m not going to…
-
1
votes3
answers1640
viewsDatetime function C#
I came across an exercise in which to convert the date of AM/PM format to military format (24h). So, suppose the user type 07:05:45PM, the program should return 19:05:45. I don’t really like looking…
-
1
votes2
answers63
viewsSQL query to identify available hourly providers
I have a table for service providers that informs the time they are not available. id_prestador | id_pedido | hora_entrada | hora_saida 1 | abc1 | 2017-08-10 10:00:00 | 2017-08-10 14:00:00 2 | xpto2…
-
1
votes1
answer101
viewsXamarin Forms - How to make Datime.Now dynamic?
How to make the Datime.Now. dynamic on Xamarin Forms ? I need time to keep running. In this case it’s stopped. I have a Label that captures the data of a class Label Text="{Binding data}"…
-
1
votes1
answer345
viewsConverting E MMM dd HH:mm:ss Z yyyy to dd/MM/yyyy HH:mm:ss c#
I’m getting the following date Thu Sep 01 00:00:00 BRT 2016 and need to convert to dd/MM/yyyy HH:mm:ss Only that the Convert generates error, I’m receiving this date via string of a System. Can…
-
1
votes1
answer103
viewsError inserting date in sprint in jira
When I try to start my sprint this error appears in jira…
-
1
votes1
answer3489
viewsError "could not be Parsed" when converting string to Datetime type
I get a Date String like this: 2017-10-11 10:39:04.217923 I take that number off after the point, and I use the LocalDateTime.parse(): private final String PATTERN_DATA_HORA = "dd/MM/yyyy HH:mm:ss";…
-
1
votes1
answer106
viewsDatetime Picker
I’m using this datetimer Picker datetimepicker The date appears like this: 2018 January 30 - 10:00 And I want it to look like this: 2018-01-30 10:00 You can do it in jquery or I need to change the…
-
1
votes2
answers125
views -
1
votes3
answers1421
viewsCompare if two date fields are equal in C#
I have a form and in that form I have two date fields, the campodata1 and completed by the user and the campodata2 and filled by the database, now I need a code to compare if these two fields are…
-
1
votes2
answers291
viewsHow to post date and time using datatime type in sql
PHP: $date = new DateTime(); print_r ($date); outworking: DateTime Object ( [date] => 2017-11-07 15:51:26.000000 [timezone_type] => 3 [timezone] => America/Sao_Paulo ) OK so far. Database…
-
1
votes1
answer56
viewsUse date Picker in Asp.net
I’m creating an Asp.net (Vb) website with a master page behind it and I can’t get the Picker date to work Can help me or indicate a Picker date even of the nuggets?
-
1
votes1
answer171
viewsHow to add a left 0 to a datetime
I need to be able to add a 0 to the left in the hours when sql only takes 3 digits or it is from midnight to 9 am so that the information is ordered! Because if not the information I have is in the…
-
1
votes2
answers1096
viewsError formatting string for python datetime
I am trying to format a string with the format "2018-05-09T05:05:34Z" for "09/05/2018" but is given the error ValueError: unconverted data remains If I use: dataAntiga = "2018-05-09T05:05:34Z"…
-
1
votes1
answer6739
viewsDate column of the Dataframe
I have this Dataframe and would like to separate the column from the date as I do it? Data e Hora Consumo(litros) Valor Acumulado 0 2017-08-21 20:00:00 65 65 1 2017-08-21 21:00:00 81 146 2…
-
1
votes1
answer2812
viewsConfigurations environment timezones Django postgres linux
Good morning to all. I have a website (Django) in a Linux hosting service with SQL Postgre bank that is in New Jersey (USA). Users are in Brazil, therefore I have a difference of Timezone. I’m sure…
-
1
votes2
answers3993
viewsMomentjs - How to add/subtract datetime?
Follows code: var value = '/Date(1533227866063)/'; var utc = moment().utcOffset() / 60; // -180 / 60 = -3 var datetime_utc = moment(value).format("DD/MM/YYYY HH:mm"); // 02/08/2018 13:37 var…
-
1
votes1
answer895
viewsConvert fraction of hour to hh:mm:ss
My hourly data set is stored in the time = [0 variable. , 0.08333333, 0.16666667, 0.25, 0.333333, 0.41666667, 0.5 , 0.58333333, 0.666667, 0.75, 0.83333333, 0.91666667, 1. , 08333333, 1.16666667] Can…
-
1
votes1
answer249
viewsWrong date format on Xamarin Forms, how to resolve?
In my mobile application I have a part that I recover the local date and time, so the date is bringing first the month, then the day and for last year, how to change this, here is my code: In my…
-
1
votes1
answer617
viewsDoes query with date in sql include the day in question?
I have a doubt in a matter of the exact days that SQL include, and my system once a day performs the following query on the system: SELECT id,nome FROM products WHERE created_date between…
-
1
votes2
answers482
viewsCalculation of interest and fines in PHP
I’m making a code that calculates interest and fines on PHP based on the amount of days past due. However, I’m having trouble getting the date and making this calculation. $databx = new DateTime();…
-
1
votes2
answers86
viewsComparison of dates with custom date class
For design reasons, the class Datetime do. NET is not suitable for me. So I decided to create my own version: public class HolidayDateTime { public readonly uint[] RangeValueDay = { 1, 31 }; public…
-
1
votes1
answer2601
viewsDate formatting error when it is on Brazilian daylight saving time (BRST)
I have a problem when removing from a date variable (Sun Oct 21 01:00:00 BRST 2018) that one hour difference, because it is generating a billing error, when the date is footprint of the database…
-
1
votes3
answers7344
views -
1
votes1
answer29
viewsGenerate subsequent month in R
How do I place the following month? df1 dt nome idade 01/03/2018 ll 15 07/03/2019 dd 33 31/12/2019 ff 44 After rules df1 dt nome idade 01/03/2018 ll 15 01/04/2019 dd 33 01/01/2020 ff 44 The rule is…
-
1
votes1
answer516
viewsPassing Date parameters for queries
I am having a problem when passing a parameter. I tried to debug by passing the Date as `string, but the problem arises that one expects a number instead of a character. After that I searched other…
-
1
votes3
answers488
viewsUsing Datetimepicker with Time
I’m using the Tdatetimepicker component. I put in the FORMAT property the following value: dd/MM/yyyy HH:mm:ss Running in form if not "click" on component and change values, example 21/09/2018…
-
1
votes2
answers2506
viewsChange only hours, minutes, seconds of a Date object
I need to change only the hours of an object of the type Date, preserving the day, the month and the year. I tried with the setMinutes(), setSeconds(), setHours(), but appears "is deprecated".…
-
1
votes1
answer337
viewsConvert String to Offsetdatetime (dd 'from' MMMM 'from' yyyy 'to' HH:mm:ss)
I got this String : 17 October 2008 at 11:35:04 And that Pattern: dd 'de' MMMM 'de' yyyy 'às' HH:mm:ss And that code: private OffsetDateTime getData(){ return…
-
1
votes1
answer122
viewsHow to change the Datatime format in C#?
I get a string with the date, put that string in a DateTime, and put this DateTime in a bank variable. The problem is that the database variable uses a different format than DateTime (Mmddyyyy), and…
-
1
votes1
answer89
viewsError of calculating days interval between two dates using diff in PHP
I am having a difference of values when calculating the interval of days between two dates. I have the following: $data1 = new DateTime('2019-06-10'); $data2 = new DateTime('9999-12-31'); If I use…
-
1
votes1
answer79
viewsDate calculation error using struct tm
My software is incremented the date in 5 minutes and works perfectly the way I am doing, Searching I found a bug that only on 16/02 of this year the calculation is not correct, follows example:…
-
1
votes1
answer150
viewsLoop Problem and Time Calculation
I want to do a program, where he reads an activity, and the time spent on it. Example: Lavando o Portão, 10:30 as 12:00, tempo gasto 01:30 I am currently with 3 problems: The way my code is…
-
1
votes1
answer152
viewsWhat kind of data to store "2019-02-06T14:14:38+00:00"?
I am consuming an API that returns me a field date with that data: 2019-02-06T14:14:38+00:00 In my Mysql database I created a field timestamp, because he was the only close I could find. Well, I can…
-
1
votes1
answer79
viewsDatetime with unknown parameters
I am integrating a program with Contaazul and one of the parameters is the date. Their date format is this: "2020-01-08T16:28:59.966Z" To get in PHP this date some parts is quiet, however someone…
-
1
votes1
answer133
viewsConvert string to Datetime with . Parseexact()
I am trying to receive a string typed by the user in the format "dd/MM/yyyy hh:mm", but whenever I use a date above 12:59 the following error occurs: System.Formatexception: 'String '25/06/2018…
-
1
votes1
answer113
viewsRepeat record in database on same day of each month
I need to schedule bills to pay and that every payment would be on a day of each month. I’m doing this, but it’s not working: $hoje = new DateTime($data_hoje); $semana = new…
-
1
votes2
answers500
viewsSelecting data and organizing by 15min Sql interval
Good afternoon, I have the following query that returns the amount of vehicles on the track between a certain time. But I want to take this interval between times and set intervals between 15min.…
-
1
votes1
answer101
viewsData munging with python
Are the following date formats: 042555 04/25/1955 Abril 25, 1955 How to use regex to transform a date format into each other (would be 6 transformations)? For example: Entrada: 042555 Saída:…