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
-
6
votes3
answers25254
viewsSubtract date and display in YEARS, MONTHS and DAYS
SGBD: Mysql Problem: How to replace the current date with a specific date and return the value in YEARS, MONTHS and DAYS in a query? Example: DADOS DataAdmissao dataAtual 2010-04-07 2014-06-27 (este…
-
6
votes2
answers830
viewsConversion from date string to datetime C#
I have a method that will receive a string in the "June 15, 2001" format, for example, which is equivalent to the date to be compared, I need to pass this string to a Datetime, as I would do this…
-
6
votes1
answer1790
viewsDisable dates before the current day in Datetimepicker?
It is possible in the DateTimePicker, disable the days before the current day?
-
6
votes2
answers9189
viewsReturn today’s date in C# in specific format
My way out has to be "2015-02-01" I tried to get DateTime.Now.ToString("yyyy-m-d"), but she doesn’t 0 between days and months.
-
6
votes4
answers1343
viewsPlugin bootstrap-material-datetimepicker disable days of the week
I’m using the Timepicker plugin called bootstrap-material-datetimepicker: (https://github.com/T00rk/bootstrap-material-datetimepicker). I’d like to be able to shut down some days of the week, or…
-
6
votes2
answers1515
viewsData Displayfor display formatting
I have a field in the database, Date Time, and wanted to display on screen to the user, but in separate fields, being Date and Time. First displays the Date @Html.DisplayFor(modelItem =>…
-
6
votes2
answers2606
viewsCheck whether the previous day is a holiday and/or Sunday
I’m having trouble developing a date validation logic. The variable dataFecha is called with -1 day to already validate the previous day. But when I go to test the validations, he did not subtract…
-
5
votes2
answers2102
viewsHow to compare Date class to System.currentTimeMillis() in Java?
How to compare if a Date object, for example "2014-01-29 00:00:00" is larger than the date of the current system, for example System.currentTimeMillis() in Java? I would like to do something like…
-
5
votes4
answers1002
viewsHow to reset the hour and decrease a day of a DATETIME?
I have a field DATETIME I take from SQL, format YYYY-mm-dd H-m-s and I need to reset the hour and shorten a day. I’m managing to decrease a day using date_modify($date, '-1 day');, but how to reset…
-
5
votes4
answers4168
viewsConvert string to Time
I got a column in the database that gets a guy varchar which corresponds the hours on my app ("HH:MM"). I need to convert this string to a type TIME and then concatenate with a type DateTime.…
-
5
votes2
answers5888
viewsTime calculation based on GMT and daylight saving time
I have a problem where I need to calculate the time in a certain place in the world. The calculation should happen and the only information I have at hand is GMT of the site. EX: -1, 2, -3, etc. I…
-
5
votes1
answer12530
viewsHow to compare two dates in Javascript or jQuery
I’m trying to compare two dates from fields text, turning them into objects Date, as follows (the first function is to format the field input with XX/XX/XXXX): function formatar(mascara, documento){…
-
5
votes3
answers7105
viewsConvert String with date to Datetime in Java
I have a CSV file and in it has a column with String: "Sun Oct 05 20:59:57 BRT 2014" I need to pass the CSV data to a Mysql table. Therefore, I need to convert this string to Datetime format so I…
-
5
votes1
answer2373
viewsHow can I get the current date and time in #R?
I am creating a routine process report, a simplified "logfile", and would like to store the date the time of the error moment in a variable. What function results in the date and time of the moment…
-
5
votes1
answer5689
viewsDifference between hours greater than 24 hours excel
How to calculate difference between hours in Excel when it exceeds 24 hours? Example: A1 = 05/01/2016 11:40:53 B2 = 06/01/2016 12:29:53 B2-A1 = 24h:49min But he returns 00:49…
-
5
votes4
answers5492
viewsDifference between two dates, ignoring weekend - working days only
I was looking for something similar, but unfortunately I found nothing. I found this solution that helped me a lot but is in Java. How to calculate the difference between two dates by ignoring…
-
5
votes2
answers4659
viewsComparing only the Datetime field date in C#
I only need to compare the date of two fields DateTime. DateTime aux = new DateTime(2016, 09, 02, 10, 0, 0); if (aux.Equals(DateTime.Now)) { //Alguma ação... } In the code above, I need you to enter…
-
5
votes5
answers29254
viewsHow to convert date to dd/MM/yyyy format?
After I published my app, I started to receive the dates in the American format like this:9/14/2016 12:00:00 AM How to format to dd/MM/yyyy? I tried to convert.ToDateTime() more does not work.…
-
5
votes1
answer96
viewsCatch the time on a remote computer using C#
Is there any method for me to recover time and date from a remote computer using C#?
-
5
votes1
answer587
viewsConvert String from Jtextfield to Calendar
How to perform input conversion via Swing’s Jtextfield via JDBC ? public class DadosPessoais { private Calendar dataNascimento; public Calendar getDataNascimento() { return dataNascimento; } public…
-
5
votes2
answers6288
viewsGet the current date directly from the machine
I need to implement in my project (library system) the functionality of getting the date directly from the machine. I wanted in the format dia/mês/ano, to generate the fine for late delivery of book…
-
5
votes2
answers131
viewsMysql DATE type is displayed as DATETIME on a datagrid
I create a very simple database with the following command: CREATE TABLE IF NOT EXISTS `ABC`.`Socio` ( `idSocio` INT NOT NULL, `SocioNome` VARCHAR(45) NULL, `SocioDataNasc` DATE NULL, PRIMARY KEY…
-
5
votes3
answers4840
viewsHow to Format Javascript Date by Naming the Month and Day of the Week
Hello. Have that date: 18/05/17. And I need to convert her to it: 18 mai (Thu) May: (Thursday): Thursday Does anyone know how to do this using Javascript and jQuery?…
-
5
votes2
answers5377
viewsFormatting date in java
I need to format a date that comes for example: 20161109103000 for 2016-11-09 10:30:00. I’ve tried to use SimpleDateFormat, DateTimeFormatter and I couldn’t format the date.…
-
5
votes1
answer181
viewsReturn date reversed in PHP
I am preparing a report based on the initial date (start_date) and final date (end_date). My return from filter comes through the POST, if I use then print_r($_POST), I note that the date comes in…
-
5
votes4
answers130
viewsString Manipulation in Javascript?
I have the following code var wcalcAlm = ('0140') alert(wcalcAlm) //retorno esperado ('01:40') I need that after the 2 position of the variable wcalcAlm be included :, thus having the following…
-
5
votes2
answers2279
viewsHow to get only the date month with PHP from the database
Well the date is in the format ( 2020-02-10 17:04:01 ) So I just want to take the month or day separately, the data is saved in the data Anco, I can get the whole date, but I wanted to take…
-
5
votes1
answer91
viewsWhat kind of data do you use to store the date of death in a register (Datetime or string)?
I have a record of people where I need to store birth dates (DateBirth) and death (DateDeath). Knowing that the guy DateTime in C# cannot be empty and its default initial value is 01/01/0001…
-
4
votes2
answers178
viewsHow do I get the values of a date in the "dd/MM/yyyy hh:mm" format and compare it to the system date after setting it in this same format?
I wanted to make a comparison between the date contained in the hora1 object and the system date, as I can do? import java.text.SimpleDateFormat; import java.util.Date; public class MainTarefas {…
-
4
votes3
answers1352
viewsHow to transform a date into a string format without signals in Datetime?
Examples: string data = "08072013"; string hora = "1515"; Is there a specific method for this type of format? I tried to use Convert.ToDateTime(), DateTime.Parse, etc. and all returned me an…
-
4
votes1
answer405
viewsCompare two date attributes in the database with two Textbox
How can I compare a range of two dates? data_Inicio date data_Fim date textbox_inicio textbox_fim I can do this on the ASP.NET side and the goal is that my start date will never be less than my end…
-
4
votes3
answers4171
viewsTime in Java counting seconds in real time
I want to show the system time and the seconds counting in real time in Java.
-
4
votes1
answer1518
viewsCompare two dates
I have two string containing dates dataSalva and dataDoDia and I’m wondering if the dataDoDia and 5 days longer than dataSalva how do I do this SimpleDateFormat dateFormat = new…
-
4
votes2
answers686
viewsFull Date Return Type
How do I get that return? 2014-08-05 18:29:47.757 Using the Date. Date data = new java.sql.Date(new java.util.Date().getTime()); Using that my return is just 2015-02-03 and does not return the…
-
4
votes1
answer3803
views -
4
votes2
answers1301
viewsHow to format datetime in YYYY-MM-Ddthh:mm:ss.sTZD format in Django/Python?
I’m having a hard time in Django returning the datetime in the local Timezone. No Django configurei USE_TZ=True and TIME_ZONE = 'America/Sao_Paulo' By calling timezone.now(), returns the datetime…
-
4
votes4
answers5878
viewsConvert String to Decimal
And I’m having trouble properly converting this string in decimal. decimal.Parse(txtValor.Text)=meuVen.Valor; When I put the conversion in front, it shows error after the =. I don’t know how to…
-
4
votes1
answer156
viewsHow to get Timezone?
I have the following code: var minhaData = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, meuTimeZone); Case meuTimeZone = "E. South America Standard Time"; then the value returned to…
-
4
votes1
answer269
viewsHow to calculate with 3 variables of type Datetime?
I have these 4 variables: public System.DateTime TempoOtimista { get; set; } public System.DateTime TempoProvavel { get; set; } public System.DateTime TempoPessimista { get; set; } public…
-
4
votes1
answer199
viewsConvert string to specific format in date
I have a string "sex, nov 6" and need to convert to DateTime. I’m doing it this way: DateTime datetime = DateTime.Parse(gridT.Columns[e.ColumnIndex].HeaderText.ToString()); But it’s not working. How…
-
4
votes2
answers4976
viewsRemove the time part of a date in c#
This is not working: DateTime? _data = calDataExclusao.Date; string nova_data = _data.ToString("dd/mm/yyyy"); The mistake is: No Overload for method 'Tostring' takes 1 Arguments How I remove the…
-
4
votes1
answer2619
viewsSkip to the next business day if the date falls on a weekend
In PHP, I have a certain date, coming from the database, which is the date a request was made. I need to add 5 working days on that date, which is the deadline for the request to be delivered. In…
-
4
votes2
answers2610
viewsDate and time validation
How do I make so that in the date field, is not saved a date that has already passed, for example yesterday and in the time field is not typed an invalid time, for example 27:00, only the Brazilian…
-
4
votes1
answer339
viewsTempo datetime.datetime.now()
I’m making a script where I measure the performance of a query in a database. The code is as follows:: start = datetime.datetime.now() //CONSULTA AQUI end = datetime.datetime.now() print "Time…
-
4
votes2
answers2352
viewsReset datetime time with SQL
Today, man SELECT returns the following date: 2017-11-16 10:37:16.000 I’d like you to return 2017-11-16 00:00:00.000, can help me with this formatting?…
-
4
votes1
answer166
viewsIf I have two servers (application and database) with different time zones, which one is better to use as a base?
I am working with the Mysql server of a hosting, I can not change the time zone of the same, I mean it uses the "Mountain Standard time (MST)", on the other hand, I am using the ASP.NET server and I…
-
4
votes1
answer250
viewsAdd 1 minute to the hour
I have a problem solving an exercise. It may be easy but I’m not finding the right solution. I have the following class Time public final class Time { private final int hours; private final int…
-
4
votes1
answer979
viewsHow to catch the date and minimum time of the day with Localdatetime
I have this dateHora in the database: 21/07/18 15:52:00,000000000 When the query passes by parameter one LocalDateTime, I want to list all the dates that start the day. How to get the minimum date…
-
4
votes1
answer2803
viewsConvert Localdate to Localdatetime
I have in my Filter class the following attributes: private LocalDate periodoDe; private LocalDate periodoAte; However, the object in which the information is located the attribute that will be…
-
4
votes4
answers915
viewsConvert date format to php
Personal I am working with Wordpress php and get from the database a date in the following format: "22 October, 2018", more need to convert it to "2018-10-22", how do I get that? tried:…