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
-
2
votes1
answer80
viewsUse Separate Date Time
I have a Datahora field and wanted to use it separately, that is, a single field in the database called Datahora of the datetime type, and manipulate this field with two editorfor where I save the…
-
2
votes2
answers888
viewsWorking Hours Calculation - Java
How to calculate the working hours worked, for example, in the company if it works 540 minutes per day, in the system of orders of services I need to compute the hours of service executed, in this…
-
2
votes1
answer49
viewserror with EF and Mysql query
I have the following consultation: var produto = (from a in context.ItensReceita join b in context.Receita on a.t0080_id_receita equals b.t0080_id_receita join c in context.Medicamento on…
-
2
votes1
answer3360
viewsDate format in Asp.net mvc
I’m having problems with the date format on en in an Asp.net mvc application. Where it displays error if the date is in the form dd/MM/yyyy HH:mm, and only let it pass if the date is in the formed…
-
2
votes1
answer199
viewsSending shortened date does not work abbreviated Asp.net mvc
I am creating a form in ASP.NET MVC and, creating the field "Datamessage", I initially put Textbox to load a date with the month in full, as below: Image of the form with the field "Date of the…
-
2
votes1
answer1154
viewsGlobalize - datetime does not work with en
Please follow the code: Global.asax: protected void Application_Start() { System.Globalization.CultureInfo.DefaultThreadCurrentCulture = new System.Globalization.CultureInfo("pt-BR");…
-
2
votes2
answers1145
viewsPython object datetime value extraction.
I need to extract only the time of a datetime object. How to proceed? The object returns the following output: "3 days, 22:01:00"
-
2
votes1
answer1038
viewsCorrect alternative that implements a validator for a date field in Laravel
to. $this->validate($request, [ 'data_nascimento' => 'regex:ddmmyyyy', ]); b. $this->validate($request, [ 'data_nascimento' => 'required|date', ]); c. $this->validate($request, […
-
2
votes1
answer69
viewsChange date to business date (Mysql)
I need to change the date of my database, considering the Business Date used in the company I work. Here, a commercial month is between 26/M-1/AAAA and 25/M/AAAA. Where M-1: last month. For example,…
-
2
votes1
answer4309
viewsSubtract date from datetime
I need to take current date and subtract 3 months. Bang making conversions and subtracting 3 but will go wrong to turn the year, in January for example will result in month -2. I believe that there…
-
2
votes2
answers207
viewsDoes the PHP Datetime class support the creation of dates in the Brazilian format?
In the code below echo be printing +273 days, but the right one wouldn’t be +9 days? $datetime1 = new DateTime('01/04/2018'); $datetime2 = new DateTime('10/04/2018'); $interval =…
-
2
votes3
answers892
viewsDate and Time in Datetime format
How do I concatenate these two variables to ISO format (Y-m-d H:i:s)? $data = '17-04-2018'; $hora = '16:12';
-
2
votes2
answers857
viewsGroup By By Data
I have a table called tsc, with the properties ID and DataHoraOcorrencia. I need to check the amount of ID for DataHoraOcorrecia. SQL SELECT DataHoraOcorrencia as DataHora, COUNT(tsc.ID) as…
-
2
votes2
answers233
viewsPlot time series on defined scale
I have a time series record, and I’m having trouble plotting on an appropriate scale. Take this example: #Gerar sinal v1 v1=sin(seq(from=0, to=3*2*pi, length=11060)) #Gerar sinal v2…
-
2
votes2
answers786
viewsDifference of months between two dates, without considering the day of the month
I am making an application for labor calculations. I need to receive two dates and know the amount of days/ months/ years. Ex.: from 08/03/2017 to 07/03/2018 is to give 12 exact months, in my code…
-
2
votes1
answer45
viewsI would like to assign yesterday as an initial date every time my program is started on a dateTimePicker
I can assign value to it just don’t know how to assign a Yesterday private void Form1_Load(object sender, EventArgs e) { dateTimePicker1.Value = DateTime.Today; }…
-
2
votes2
answers396
viewsConvert date string to ISO 8601 format (with "T" and "Z")
With a string date in the format 01/01/2018 13:00:40, how I could convert it to ISO 8601 format using the "T" and "Z"? Example: 2018-01-01T13:00:40Z I got it this way: datetime.strftime(…
-
2
votes2
answers724
viewsParsing a timestamp with Timezone
I was making a little code to implement a treatment case in a friend’s application module and got stuck with a problem. This is a unitary test. To put in the application module I would have to make…
-
2
votes2
answers750
viewsFormatting Date, Time and Time in PHP
I have the following string: 2019-05-13T10:00:00.000Z And I’d like to turn it into this format: 'Y-m-d\TH:i:s'. But I couldn’t find in any documentation what the correct time zone format for the…
-
2
votes2
answers297
viewsDetermine time in function
<?php $ler = $_COOKIE['viu']; if($ler == "1") :?> <?php include 'libera.php';?> <?php else :?> <?php include 'bloqueia.php';?><?php endif; ?> I want to modify the above…
-
2
votes2
answers102
viewsHow to convert the If-Modified-Since header to a date (and vice versa)?
The header If-Modified-Since displays the following return format: Wed, 21 Oct 2015 07:28:00 GMT I need to compare this date that comes in this header item with the creation date of a file on my…
-
2
votes2
answers2340
viewsError: "java.text.Parseexception: Unparseable date: "2018-11-14T12:12"
I have the following data insertion interface: The comments below represent attempts to fix the error but none worked. In HTML the type is datetime-local, in the bank the type was created as…
-
2
votes2
answers1740
viewsComparing datetime with minutes interval
I need to compare 2 dates, these dates are in format %d/%m/%Y %H:%M:%S and one is obtained through the internet, and the other locally, however I am not able to compare the two with an interval of 2…
-
2
votes3
answers118
viewsWhere am I going wrong to calculate age?
function idadeAluno($dataNasci){ $nasci = new dateTime($this->dataNasci); $agora = new dateTime(); $idade = $this->nasci - $this->agora; echo 'idade aluno:'.$this->idade.'<br/>'; }…
-
2
votes2
answers395
viewsHow to assign a default date on a Datetime type object in C#?
I created a class called Order, and in it I created a field for the purpose of entering a date of delivery of the order. But I created the object on Main(), and at the time I execute it fills in…
-
2
votes1
answer348
viewsPandas: Subtract dates into grouped indexes in a dataframe
I am conducting a research using pandas and need to infer the time between two buses based on their start times (start_time). For this I have grouped in my dataframe a field for itinerary and…
-
2
votes1
answer69
viewsFunction to check if the year changes
I have this code that almost works perfectly. I went to do a test, and when it arrives to generate in January, it generates for the same year, example it generated an invoice for 15/12/2019 and has…
-
2
votes2
answers1707
viewsBrazilian calendars using Pandas-python
How do I import the holiday calendar from Brazil using the pandas library in python. For example, if I use the following code: from pandas.tseries.holiday import * feriados=…
-
2
votes1
answer479
viewsHow to format datetime in a Flask application?
How can I make it show only dd/mm/yy and take the hours and seconds in my database or templates? Database: class User(db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True)…
-
2
votes2
answers552
viewsHow to insert a midnight datetime into mysql?
I’m using the Laravel Framework 5.8, I am trying to register a record in the database where I need to set in API some dates. Although they are CURRENT_TIMESTAMP, i also need to be able to enter a…
-
2
votes1
answer433
viewsPython Pandas: Dataframe convert Timestamp column to Datetime
How can I convert a Dataframe column from Timestamp to Datetime? btc_df = pd.DataFrame ( bars_day , columns=['date' , 'volume' , 'open' , 'high' , 'low' , 'close'] ) Summary date int64 volume object…
-
2
votes1
answer110
viewsFormat difference between two dates
I calculated the period between two dates in the format d H : M : S, and now I’m trying to format it, but I still can’t, follow an example of what I want to, and my code: ENTRADA Dia 5 08 : 12 : 23…
-
1
votes1
answer138
views -
1
votes2
answers893
viewsCalculate the difference between timezone dates
I need to calculate the difference between 2 dates with different time zone: The calculation is between the date of posting and the current date. Assuming a post is from America/Sao_Paulo and…
-
1
votes2
answers198
viewsdate validation
I am creating a validation class and I have a method to validate dates. When will I validate based on now, strtotime calculates including time. $v->rule( '07/28/2014' , 'before.2014' ) this rule…
-
1
votes2
answers1630
viewsIn php how to run a function after past X days of last run
I’m designing changes and routines in a web application created in PHP and Cakephp, in which case one of the routines would be a Component run every 15 days , to update a file. html As in PHP I…
-
1
votes1
answer2717
viewsCheck File Creation Date and Delete
I created a Backup application, it saves the files in zip format DD-MM-YYY - 00-00-00.zip, but would like to know how I would do to check creation date for deletion, because the name of the files…
-
1
votes1
answer188
viewsFormat Textbox with date
I have here a form with several textbox and some combobox. What happens when I insert a code and fill the textbox with birth date appears to me in this format 01/01/1900 00:00:00 and I just want the…
-
1
votes1
answer89
viewsPython - Convert mysql datatime
I am trying to compare the current date with the date of the last entry of my mysql database: sql2 = "SELECT created_at FROM tempaverage WHERE created_at IN (SELECT max(created_at) FROM…
-
1
votes1
answer640
viewsDates with JSON /Highcharts
I have a problem with dates while plotting a Highcharts chart using JSON object. Data referring to date information is being displayed as follows: The Server sends JSON as follows to the client:…
-
1
votes1
answer296
viewsConvert data javascript to work in PHP
I’m trying to capture the file date via javascript and send it to PHP. Motive? I want the date of the last file change. $('#last_modified').val(arquivo[0].lastModified); Variable file is: <input…
-
1
votes3
answers1378
viewsDatetime field display in View with hours, minutes, day/month/year?
How to manipulate the datetime and show in view in the following format? HH:MM dd/MM/aaaa
-
1
votes1
answer626
viewsHow can I show the next 7 Days (Calendar) C#
Hail, good night I am working on a C#solution, where I have to develop an agenda and at some point I intend to show the events (if any) as well as show the following 7 days, even if they are not…
-
1
votes1
answer1329
viewsComparison of PHP dates - dd/mm/yyyy
I’m looking to do a PHP date comparison of the type: if Datastart >= Datatoday + 3 days, do such a thing. Otherwise, do nothing. I tried something like this: if…
-
1
votes1
answer1937
viewsCalculate the minute difference between two input time fields
How best to calculate the difference of minutes between two camps input time with PHP? Example of two fields input: <label for="Cseg3">Horário 1:</label> <input type="time" id="Cseg3"…
-
1
votes1
answer608
viewsError when calculating time difference with Datetime after 00:00
I’m having a problem figuring out the time between two times with the datetime when the departure time is between midnight and 1 a.m.. For example, if the first time is 14:00, and the second time is…
-
1
votes3
answers412
viewsFilter records via datetime and bring them between an initial and final date
I have the balance table, that always when running a precedent, It is generated a new record in the same, You can have several record in the same day... However, when making a query, I want to bring…
-
1
votes2
answers10665
viewsHow to get time difference between two Datetime variables in C#
I have two variables DateTime, which are Datacadastro and DataAtual(DateTime.Now). I need to know if the time difference between these two dates is greater than or equal to 4 hours. Is there any…
-
1
votes1
answer132
viewsHow to return the Timezone timestamp set?
I’m trying to return the timestamp of my city. When I use the instruction ('Y-m-d H:i:s') it returns the right time of my region but I need to return the timestamp of that hour and it seems that…
-
1
votes1
answer373
viewsProblems with Lambda and Datetime consultation
Hello I have the following Actionresult code from my controller below: [HttpPost] [AuthorizedUser] public ActionResult Load(DateTime DataInicial, DateTime DataFinal) { var AcessoDominio = new…