Most voted "date" questions
Date is the representation of a specific point in a calendar, usually represented by a day, month and year, the values of which may vary according to the culture and calendar used.
Learn more…887 questions
Sort by count of
-
7
votes2
answers299
viewsCompared to Datetime class, is the date function more performative?
It is very common to read some tutorials or articles saying that programming Object Oriented can cost more (I speak in relation to memory). Since I started programming, there’s that little itch in…
-
7
votes2
answers2154
viewsHow do I convert a date into American format in Angular?
I’m using a Json No Laravel 5 response, where I use Angular to display this data. The date in Laravel is returned in format 2017-05-17 15:56:46. When trying to use filter date at the angle,…
-
7
votes2
answers753
viewsDaylight saving time with old dates
In my system save all dates on UTC, but in the user view I show in GMT -3. The problem is when I save a date in summer time, because in case it will no longer be made the difference of 3 hours, it…
-
7
votes1
answer398
viewsFind the last day of the month
At the beginning of the month I always need to calculate the age of people within a certain database. I always consider the last date of that month, for example: in September I calculated the age…
-
7
votes2
answers4291
viewsDifference between date and datetime
I was researching the type of data SQL SERVER and I came across this table What would be the real difference between date and datetime data? Time, minute, second notation only ? What would that…
-
7
votes4
answers2085
viewsDoes the date conversion always remain in en-BR?
I’m trying to convert a date in Asp.Net MVC to yyyy-MM-dd, what happens is that always when I convert and display this date it gets dd/MM/yyyy and I don’t know why it happens. How to solve this?…
-
7
votes1
answer8513
viewsHow to do Localdatetime(Datetimezone.forID("America/Sao_paulo")) in Java.time
I wonder if there’s any way to mimic that code on java.time: LocalDateTime(DateTimeZone.forID("America/Sao_Paulo")) I don’t work very well with date in Java, if you can also explain to me what this…
-
7
votes2
answers600
viewsPrint only the last two digits of a year
How to make the year have only two digits? data = new Date().getFullYear(); console.log(data); console.log(data.substr(2,4));…
-
7
votes1
answer1853
viewsWhat does the number returned by System.currentTimeMillis represent?
I went to read the documentation, made available by IDE and came across this: It is said that the method System.currentTimeMillis returns: the Difference, measured in milliseconds, between the…
-
6
votes4
answers2972
viewsConvert data to Timezone
new Date() in Javascript returns me this format: Tue Apr 01 2014 13:43:13 GMT-0300 (BRT) I need to convert this to a java.util.Date. That’s what I’m trying to use SimpleDateFormat but I couldn’t…
-
6
votes1
answer223
viewsComparison of PHP schedules
date_default_timezone_set ( "America/Sao_Paulo" ); $dtz = new DateTimeZone('America/Sao_Paulo'); $dt = new DateTime('now', $dtz); $offset = $dtz->getOffset( $dt ) / 3600; $por_do_sol =…
-
6
votes1
answer276
viewsHow to convert a date to this format in PHP?
Can anyone tell me what kind of date this format is? 2013-09-17T05:59:00+01:00 I have in the database a timestamp or date field. How to convert its value to this format using PHP?…
-
6
votes1
answer305
viewsString para Date
I’m creating some parsers and was doing some tests to develop Date’s. This code: value = '2015-12-31 23:16:00' value = value.replace(/(\d{4}-\d{2}-\d{2}) ?(\d{2}:\d{2})?(:\d{2})?.*/, '$1T$2$3');…
-
6
votes2
answers2441
viewsConvert date and time to numeric value in Javascript
I saw in the Kibana dates are treated as numerical values. For example, the date 2016-05-03T10:00:00 is equal to the numerical value 1462280400000. I would like to understand how this works, and…
-
6
votes3
answers1926
viewsHow do you know how many days are in the current month?
How to know how many days is the current month Mysql, example: setembro = 30dias Motive: I have a goal : exemplo: 1.000,000 I need to take the value of the goal and divide by the amount of days you…
-
6
votes2
answers1536
viewsFormat Date Return with Date and Non-string Format
I’m trying to return a date that is recorded right in the bank (1986-04-30 17:02:00), I try to convert this date to appear only "30/04/1986", but no use. The most I can get back is Wed Apr 30…
-
6
votes1
answer3033
viewsDate in Portuguese (en-br)
I have the following code in PHP: <?php setlocale(LC_ALL, "pt_BR", "pt_BR.iso-8859-1", "pt_BR.utf-8", "portuguese"); $tz_object = new DateTimeZone('Brazil/East'); $datetime = new DateTime();…
-
6
votes4
answers2358
viewsReturn day of week from date in dd/mm/yyy format
I have this function that brings me the day of the week: public static String getWeek(String date){ //ex 07/03/2017 String dayWeek = "---"; GregorianCalendar gc = new GregorianCalendar(); try {…
-
6
votes4
answers19332
viewsCompare current date with javascript
I’m comparing today’s date to today’s date this way: if (new Date() > new Date('07/04/2017')) { alert('Hoje é maior que hoje?') } How can today be bigger than today?…
-
6
votes1
answer96
viewsDate conversion
I have a date in this format "2017-10-13T18:15:41.143Z" And I would like a date in this format 10/06/2017 01:42:34 PM (-0300) How can I make the conversion?…
-
6
votes3
answers5107
viewsWorking days and Java 8 API, how to check?
How do I verify that a day is useful using the Java 8 API? It is possible to check whether it is Saturday or Sunday, but how to check for example holiday like September 7 (Independence of Brazil) or…
-
6
votes1
answer477
viewsIs the PHP Day of the Week feature limited?
I am making a calendar using PHP and JS and worked perfectly between 1902 and 2037, because from 2038 the function to catch the day of the week in PHP returns an incorrect value. Is there a specific…
-
6
votes3
answers4742
viewsConvert string to dd/mm/yyyy hh:mm format
How can I convert a date that is string to a date type? I tried to do it this way but it didn’t work: var string = "19/07/2019 14:18" var date = new Date(string); When I give a console.log(date);…
-
6
votes2
answers191
viewsTypescript - Incorrect code output - Date
Why the output from that code is: Pessoa { Id: 1, Name: 'Maicon Gabriel Friedel', DateOfBirth: 1997-02-22T03:00:00.000Z } Code: import pessoa from './pessoa' pessoa.Id = 1; pessoa.Name = 'Maicon…
-
6
votes4
answers1946
viewsIncorrect Date/Time Formatting Nan/Nan/Nan Nan:Nan:Nan
The Field DateTime that returns from Database is formatted as dd/MM/yyyy hh:mm:ss, by now when you start looping ($each) the code below the format changes to: "/Date(1566322265000)/". I created this…
-
6
votes4
answers729
viewsHow to get the month formatted with zero left in Typescript
I’m trying to get the month in Typescript with Node.js, I’m trying to get it like this: const today = new Date(); var todayMonth = today.getMonth() + 1 if(todayMonth < 10) { todayMonth = '0' +…
-
6
votes1
answer348
viewsHow to check if a year is leap in Java?
How to know if the current year - indeed, if any year - is leap? Since I can have only the numerical value of the year, or an object representing a date (i.e. Date, Calendar, LocalDate, etc), the…
-
5
votes5
answers6853
viewsConvert Date field data to Mysql month
In a comic book table I have a 'Data' field (0000-00-00) and I need to do the following: Create a field next to 'Month' that takes the date Ex: 2014-08-27 and pass the value 'August' to the month…
-
5
votes1
answer1327
viewsHow to set date formats in Django 1.7 for the whole system
Is there any way to change the display settings and/or date formatting at system level?
-
5
votes2
answers21755
viewsHow to get Date in Day, Month, Year and Time format with Jquery
I have a piece of code that I can get the date and time, but the date is in the format Mês/Dia/Ano followed by time, but precise in format Dia/Mês/Ano followed by the time, I tried to change the…
-
5
votes3
answers198
viewsHow to humanize javascript dates
Given a date ex: 24/05/1982, how to transform into years, months and days? In the above example it would be converted into 33 years 1 month and 1 day. The idea is to do everything in Javascript.…
-
5
votes2
answers733
viewsHow to make a full date common?
I receive a string with a date, and unfortunately there is no way to change it, in the format: 1 de September de 2015 And make it into: 01/09/2015 The only way I could do this would be to break the…
-
5
votes3
answers13820
viewsCalculate age per day, month and year
I’m trying to calculate the age per day, month and year but I’m not getting it. I followed some examples but they all go wrong too. For example if the date of birth is 14/06/1992 this method returns…
-
5
votes3
answers11756
viewsChange format of a date from yyyy-MM-dd to dd-mm-yyyy
I have a dataTable where I display some data but the date is coming in format yyyy-mm-dd how do I change the format of this date so that I can display it correctly in my dataTable? And where do I do…
-
5
votes3
answers426
viewsWhen should I wear the new one or not?
What happens here? Why is an instance of Date in this example: String dataFormatada = new Date().format("dd/MM/yyyy") Already in this example was not used the new: def data =…
-
5
votes2
answers1620
viewsCompare equal dates in javascript
With reference to these two questions: Simple comparison between dates How to compare two dates in Javascript or jQuery I need to compare the dates and I need three distinctions between two dates,…
-
5
votes1
answer2373
views -
5
votes1
answer983
viewsAlgorithm - How to catch days in a JS week
I have the following situation: I need to set the days of each week within a month, creating an array of JSON objects. Each position would correspond to a week, for example if there were 5 weeks I…
-
5
votes2
answers9742
viewsHow to insert current date in postgresql?
I need to set in a column on postgresql the current date of insertion as the default value for the field. How can I do that?
-
5
votes1
answer7176
viewsI want to compare start date and end date. The start date always needs to be less than the end date. Compareto() an error came to me
When the final date is with the time of 00:00, it identifies that the initial date is greater than the final date only it is not, the initial date remains smaller. When I set the final date…
-
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
answers2991
viewsSQL for last month and last two months
Hi. I’d like a hand here. I need to get the records: Mysql bank 1) last month 2) last quarter 3) Current year SELECT id, data, lote, modelo, qtd FROM controle_diario WHERE modelo like ? The table is…
-
5
votes2
answers961
viewsHow to convert string (in English) to date?
I have a data.frame with a column (mes) that represents the month and year of each observation that is in string form. I wanted to modify it to date so I could use proc in excel with date. How can I…
-
5
votes1
answer846
viewsSubtract input date with current date
I am trying to subtract a date that the user type in the input with the current date. var data1 = $("#data_viagem").val(); var data1 = data1.split("/"); var viagem = new Date(data1[2], data1[1],…
-
5
votes1
answer677
viewsComparison between dates
I am wanting to validate the inclusion of dates in my system, referring to the lot of products, but I believe I am a little hasty in the way I am doing. For what I need, I thought of three…
-
5
votes2
answers398
viewsConvert date to Unix timestamp
I have a table in a Mysql database that has a date column VARCHAR, guy 20-09-2017 and I need to migrate this column to a column bigint(8) using the date format timestamp unix. How to do this?…
-
5
votes4
answers4894
viewsPHP returning wrong current time
I’m having a problem using the function date using the parameters to return the current time. When I use the function: $hora = date('H:i:s'); When I give a echo in the variable $hora to verify, I…
-
5
votes4
answers4894
viewsPHP returning wrong current time
I’m having a problem using the function date using the parameters to return the current time. When I use the function: $hora = date('H:i:s'); When I give a echo in the variable $hora to verify, I…
-
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
votes3
answers1204
viewsHow to get the system date in Javascript?
It’s a simple question I imagine, I’m starting my studies in Javascript and would like to know how to get the date of the computer (year, month, day, hour, minute and second). Also, does the date…