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
-
4
votes2
answers3023
viewsQuery in Mysql to return scheduled records for the next 30 days
I have a table called AGENDA, where I have the fields, ID, Location, Date. Do the insertion and selection inside the database already managed to do correctly. But I can’t select the date in…
-
4
votes2
answers828
viewsChange date format in PHP
I’m trying to change the date format as follows: public function getDate() { $date=$this->date; return $date->DATE_FORMAT($date,'%b %d %Y %h:%i %p'); } But I’m not getting the date in AM and…
-
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
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
votes2
answers105
viewsWrong date calculation
I have the following method: TimeSpan dt = dataFinal.Subtract(dataInicial); double anos = Math.Floor(dt.Days / 365.25); double meses = Math.Floor(((dt.Days - anos * 365.25) / 30)); return…
-
4
votes3
answers1334
viewsSQL query in PHP and date format
I have a PHP function that interacts with my SQL Server. It looks like this: public function buscaRelatorioHospedagem($nome,$de,$ate){ // TODO Essa função pode ser aproveitada pra aba nova $de--;…
-
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
votes3
answers42573
viewsCalculate difference between two dates to validate date fields
I needed to find a mechanism to limit a search no longer than 3 months. I have two dates, I want to validate if they are within the defined parameters. have this code() I am using type date and…
-
4
votes2
answers999
viewsHow to read data with variables in lines, in Rstudio?
I am starting with the R language in Rstudio. I am an advanced MATLAB user but with difficulties in R. My question is: I have a spreadsheet where each row is a variable and each column is an…
-
4
votes1
answer237
viewsLimit to the strtotime function in php
I’m using the strtotime function as an example below, with cakephp. by spending the sum of 50 years is returning null, the most I can return is adding 20 years. Would anyone know if this is a…
-
4
votes3
answers4136
viewsHow to subtract a date from the current system date
I want to subtract the current system date with the date that is saved in mysql. I insert the date into mysql via INSERT, manually, because I will not always use the current date to insert into the…
-
4
votes3
answers177
viewsCreate a table with dates
I am creating a table and I need the columns to be created as follows: Mon, 23 Nov | Tue,24 Nov | Wed,25 Nov | Thu,26 Nov | Fri,27 Nov | Sat,28 Nov | Sun, 29 Nov To create the Table I pass a date…
-
4
votes3
answers1667
viewsFunction to format dates
I have a question regarding Javascript . I want to create a function where you get a date and then you can show it as you like. for example YYYY/MM/DD or DD/MM/YYYY or any other way. I have the…
-
4
votes4
answers912
viewsAdd variables to obtain end date
I have a form with a rental register. In it, I have the fields $datainicio, $meses and $datatermino. The start date I put automatic, according to the date of the day. The months must be placed at…
-
4
votes2
answers1362
viewsPHP Current business days/ Missing days
I would like to know about if you have a specific function or how to do about the current working days for example today is day 26 or is 18 current working day of the month and so on and as change…
-
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
votes1
answer37
viewsProblem endpoint function R
I’m working with this date.frame: St <- data.frame(read.csv2("interest_LastMonthDay.csv")) Date AAA_S.t. Date.1 BBB_S.t. Date.2 CCC_S.t. 1 27/12/88 1,80400 28/12/88 0,8368 28/12/88 0,0080 2…
-
4
votes1
answer5678
viewsReturn higher value of a specific SQL record
I need my SQL to return the longest date, but not the longest date among all records, and yes, the longest date of a specific id. I’ve tried using the MAX(), but it returns the highest value of all…
-
4
votes2
answers649
viewsDelete files created more than 10 days ago, saving the latest if everyone from the list has more than 10 days of creation
I did this question where doubt was how to delete files with more than 10 days of creation. I recover them from a directory and the code has already been implemented and is functional. However, I…
-
4
votes2
answers382
viewsFormat value with explode and implode PHP
I have a dhEmi tag that has this value 2016-09-09T08:10:52-03:00 To return me a datetime I did the following. $dtemis = $item->infNFe->ide->dhEmi; $res = explode("T", $dtemis); $res1 =…
-
4
votes2
answers833
viewsVarchar or Datetime?
I always save my bank dates using the type datetime. When displaying these dates in an application, I do something like: select Convert(Varchar, GETDATE(),103) Data Upshot: 04/10/2016 I’d like to…
-
4
votes1
answer126
viewsHow can I make a New Year script?
Good guys, I searched how to do but could not. I want a javascript code that turns on automatically only after midnight. See the code: var agora = new Date(); var anoNovo = new Date(2017, 0, 1, 0,…
-
4
votes2
answers9324
viewsSubtract days from an input date with javascript
I need to take a data from a type number field and add to a date of a input date. I already did, but now I need to get the result of that date and subtract 14 days, but I can’t get it. I’m a…
-
4
votes1
answer620
viewsTraversing Dates using Calendar
I’m making a report on java, I spend a period specified by the user. In my DAO I’m doing the treatment. Here I take the last date. String data1 = DateUtil.toString(dto.getDataInicio(), "MM/yyyy");…
-
4
votes1
answer2365
viewsHow to get tomorrow’s date with Javascript?
Hello. I have that code: var datas = new Date(); console.log(datas.toLocaleDateString()); He returns to me: 22/05/2017 Is there any way to make him always return with an extra day? like this:…
-
4
votes2
answers1055
viewsConvert seconds to timestamp?
I am creating a PHP script to generate a json from a caption file webvtt, take the beginning and the end that are in the format minuto:segundo.milisegundo or if the video is too big they come as…
-
4
votes4
answers1413
viewsKnow what day falls next Monday
I need a schedule for an agenda that gives me the date of next Monday from a certain date Ex: today and day 01/06 I need to know what day the next 10 Mondays will fall. 1 = 05/06/2017 2 = 12/06/2017…
-
4
votes2
answers4518
viewsSelect multiple lines of a data.frame from the highest R values
I have the following date.frame in R: df <- data.frame(x = c(10,10,2,3,4,8,8,8), y = c(5,4,6,7,8,3,2,4)) df x y 1 10 5 2 10 4 3 2 6 4 3 7 5 4 8 6 8 3 7 8 2 8 8 4 First point: I would like to get…
-
4
votes1
answer64
viewsHow to format the day of the week to not show symbol in PHP
How to exchange the symbol � appearing on Tuesday by a C? My code below: <?php setlocale(LC_ALL,"pt_BR", "pt_BR.utf-8", "portuguese" ); date_default_timezone_set('America/Sao_Paulo'); echo…
-
4
votes3
answers2732
viewsReturn hours and minutes apart with PHP
I have this simple file: php test. <?php $date1='2018-01-09 16:14:01'; $date2='2018-01-09 17:30:04'; $dateS1 = new \DateTime($date1); $dateS2 = new \DateTime($date2); $dateDiff =…
-
4
votes1
answer739
viewsReturning week number of the month
In January this year (2018) I have 5 weeks in the same, being them: 1 week: 1 to 7; 2 week: 8 to 14; 3 week: 15 to 21; 4 week: 22 to 28 and 5 week: 29 to 31 (or 29 to 04 February). When using the…
-
4
votes2
answers114
viewsWhat do you call the previous month in the R?
I need the R to tell me month before we are, that is, we are in "2018-05" and I need it to give me "2018-04". So far my solution has been: format(Sys.Date()-as.integer(format(Sys.Date(),…
-
4
votes2
answers184
viewsI cannot format date
I’m trying to format one date to look like another, the first comes straight from the bank but the other needs to be in the same format. Calendar cal = Calendar.getInstance(); SimpleDateFormat df =…
-
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
votes1
answer48
viewsMean of repeated lines
People, I have a data.frame as follows Gene 12h 10d 6w Slc39a10 1.52 -6.72 -1.84 Slc39a10 1.52 -6.72 -1.84 Mfsd6 -0.15 0.672 0.26 Mfsd6 -2.55 -54.53 -23.75 Hecw2 2.13 2.71 1.92 Hecw2 -7.30 -4.34…
-
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:…
-
4
votes1
answer704
viewsHow to extract the week number of the month in R?
I’m having trouble extracting the week number of the month from a specific date. Example: hoje = Sys.Date() print(hoje) [1] "2019-02-11" In the example of the date above, hoje would be the 2nd week…
-
4
votes2
answers465
viewsHow to change the JSON serialization format of PHP Datetime?
In PHP, when I use a json_encode on an object of the type DateTime, it displays the following result: $date = new DateTime(); echo json_encode(compact('date'), JSON_PRETTY_PRINT); Exit: { "date": {…
-
4
votes3
answers4376
viewsCurrent date and time in time zone timestamp format
How can I print this date in timestamp format with time zone (timestampz)? from datetime import datetime, timedelta current_time = (datetime.now()) Upshot: 2019-03-28 15:14:19.108116 I would like…
-
4
votes3
answers1018
viewsConvert to date type 'yyyy-mm-dd'
I have a problem trying to modify the type of date that appears to me in two columns of a table of mine. This is my code: declare @top10reclamacoes varchar(max) declare @html varchar(max) declare…
-
4
votes3
answers347
views -
4
votes1
answer149
viewsCURDATE() with day and time
In Mysql I have a table with field type DATETIME, with this value: 2019-08-01 15:30:00 For control, today is day 01/08/2019 15:05:00 I want to do a query that only shows if the date in the database…
-
4
votes2
answers2021
viewsSum with dates and strtotime in PHP
In this small script of a service system, I save the beginning of the service (field DATETIME bank) and the estimated term of its end (field TIME at the bank). Look at: $d1 = "2019-09-23 12:30:00";…
-
4
votes1
answer150
viewsHow to transform an English standard date into a Brazilian standard date in R?
Suppose I have a date in the standard English format year-month-day (ymd): data = Sys.Date() print(data) [1] "2019-12-03" But I really need this date to be in the Brazilian standard day/month/year…
-
4
votes2
answers1326
viewsHow to work with timezones without using a timestamp?
I was reading that answer, of the Stack Overflow in English, and I came across the following excerpt: For Mysql (or Mariadb), if you don’t need the time information consider using the DATE column…
-
4
votes3
answers2923
viewsIntl to format date in Javascript?
I’m studying the component Intl Javascript and need to format a field date who comes from the database to the Brazilian format. Format in Mysql: 2019-12-12 And I need to turn it into 12/12/2019. The…
-
4
votes1
answer85
viewsHow to take system time and add minutes to it in Javascript?
I am making a basic "calculator" for a game, and I need a function that takes the system date and adds 30 minutes when the button is pressed. Follow the script I’m trying to use and it doesn’t work:…
-
4
votes1
answer61
viewsDate count of days when it has turn of year
I’m having trouble generating an iteration where dates are displayed from a given day to the most current day. this problem happens when it has the "turn of the year" and I put a condition of…
-
3
votes1
answer122
viewsProblem on Jcalendar-1.4 display
Hey, all right, guys! I’m creating a program and I’d like him to have a calendar on the main screen. I searched and found jcalendar-1.4, however, when adding it some numbers are not shown (they have…
-
3
votes1
answer13631
viewsHow to change the date format in SQL Server 2008?
Currently my seat is in YYYY-DD-MM format I would like to put in MM-DD-YYYY. I found the SET DATEFORMAT only it’s not the best option since I’ll have to add it to all the querys. Is it possible to…