FAQ Database Discussion Community


Get a variables value from one dataset if falling in a range defined by two variables in another dataset in R

r,date,statistics,dataset
I have a question regarding dates manipulation in R. I've looked around for days but couldn't find any help online. I have a dataset where I have id and two dates and another dataset with the same id variable, date and price. For example: x = data.frame(id = c("A","B","C","C"), date1...

SQL Display DATE

sql,date
I have this query: SELECT COUNT(DISTINCT CASE WHEN MinProduto = 1 AND MaxProduto = 1 THEN PRENUMERO END) AS QtdCombustivel ,COUNT(DISTINCT CASE WHEN MinProduto <> 1 AND MaxProduto <> 1 THEN PRENUMERO END) AS QtdLoja ,COUNT(DISTINCT CASE WHEN MinProduto = 1 and MaxProduto <> 1 THEN PRENUMERO END) AS QtdMisto...

How can I display a “dd/mm/yyyy” date as a “yyyy-mm-dd” date

vb.net,string,date,datetime
I keep seeing similar questions for Python and PHP, but I don't have access to those functions since I'm not using either of them. The language I'm using is VB.NET. So if I have: Dim date1 = "06/19/2015" then I want to convert it to "2015-06-19" I can replace to...

date -d not working on mac

linux,osx,date
I am trying to convert a timestamp to a number of seconds and it is not working as intended on a mac. On linux I can run: date -d "2015-06-11 12:39" +%s and I get 1434044340 as intended. However, when I run that same command on a mac, I get...

Convert strings of data to “Data” objects in R [duplicate]

r,date,csv
This question already has an answer here: as.Date with dates in format m/d/y in R 2 answers My problem is that the as.Date function does not convert the values in a "date" column of a data frame into Date objects. I have a data.frame nmmaps. Here is a short...

Select before specific date from one day only

mysql,sql,date
I need to retrieve data from MySQL from one day, but I don't know the interval between two rows (there may be 4 rows from one day and a gap of a week for example). Let's say I have: (following isn't code) 3 rows where date = 2015-06-15 1 row...

JavaScript Date mismatch after being stored as string [duplicate]

javascript,string,date,gettime
This question already has an answer here: JavaScript Date Object Comparison 4 answers I cannot figure out why ls_a === a is returning false in the code below. It seems like when I convert to a date to string and back to date, something is being lost, but what??...

PHP Timezone not working correctly

php,date,time,timezone
So we have in-house servers here in this EDT part of the USA America/New_York and for someone reason, this [SSCCE][1] code is not working. <?php echo date_default_timezone_get() . " <br />"; $dateCal = "2015-06-22 13:00:00"; // EDT Time $schedule_date = new DateTime($dateCal, new DateTimeZone("America/Chicago") ); echo $dateCal . " <br...

python - how to check whether some given date exists in netcdf file

python,date,select,netcdf
I read my timesteps from a netcdf file: timesteps = ncfile.variables['time'] Now I would like to know whether some given date (say, June 23th) exists in that list. If it does, I want to omit it. The netcdf file contains arbitrary dates. I have no clue how to do this...

Teradata Convert DATE to midnight

date,time,teradata
below is the original code convert(datetime, (substring(convert(varchar(26), convert(datetime,getdate())),1,12) + '23:59:59:996')) output is = 6/17/2015 11:59:59.996 I converted it to Teradata below CAST(CURRENT_TIMESTAMP AS DATE FORMAT 'MM/DD/YYYY') || ' 23:59:59:999990' but upon compiling my store proc, it produces an error below Invalid or missing expression 'E(5404):Datetime field overflow.'. Is there a...

Excel formula to check blank in range bases on criteria

excel,date
I have two ranges K1:NK1 are dates of the years (from 01/01/2015 to 12/31/2015), and K2:NK2 has text. In cell G2 I have the start date 01/01/2015 and I2 has the end date 04/01/2015. I want to add a formula in cell F1, which check the start date and end...

Python: if date is passed or not logic with strings

python,date
In a large program that iterates over many many dates, I'm trying to process only dates that are passed (or at) a cutoff_date where date >= cutoff_date. This works great 99% of the time, however check out the following: >>> print cutoff_date, type(cutoff_date) 2015-2-19 <type 'str'> >>> a = '2015-3-20'...

Difference in years between two dates

sql,postgresql,date
I have a table in postgresql which has a column datatype TIMESTAMP named birthdate, is it possible to write a sql statement that would return the difference in years from the birthdate stored in the table and the current date? How would this be done? My server is Postgresql This...

Date formatting - making dd/m/yyyy into dd/mm/yyyy

excel-vba,date,format
I got a pretty simple question (but yet I've been stuck at it for some time now). Does anyone know how to make the date value from dd/m/yyyy into dd/mm/yyyy in a variable? dim lastdaylastmonth as date lastdaylastmonth = DateSerial(Year(Date), Month(Date), 0) So this code, as of now, would return...

PHP Convert date using strtotime? [duplicate]

php,date
This question already has an answer here: php strtotime not working 2 answers below is my php code. <?php $date = "06 06 2015 6:05:00 am"; $cdate = date("Y-m-d H:s:i",strtotime($date)); echo $cdate; ?> Output is 1970-01-01 01:00:00 i need to 2015-06-06 6:05:00 Thanks...

reading OData date format in R

r,date,odata
I am reading a csv file exported from OData, and encounter a date format that looks like this: /Date(1391514600000)/. Any ideas on how to convert this into Date or POSIX in R?...

IBM Cognos _days_between function not working

mysql,database,date,cognos
I'm having an issue with Cognos 10. I'm trying to calculate the number of days between to dates so I use the _days_between( date1, date2 ) function. _days_between ([Derniere Date Changement diaphragme] , [Premiere Date Changement diaphragme]) I'm quite sure the two Dates are Date objects ( I set them...

How can I delete the '0' from my date day in django (python)?

python,django,date,datetime
I am creating a django application and I have the next problem: I have a date (for example "June 3, 2001") and I can't convert that string to date, because it doesn't exist a format directive in python to refer to a day without '0' How can I caonvert that...

PHP Checking if user is online

php,date,datetime,timestamp
I don't fully understand the PHP time functions, but I'm under the impression my function should work: function user_status($timestamp){ $online = date('Y-m-d H:i:s', strtotime('-5 minutes', strtotime(date('Y-m-d H:i:s')))); $away = date('Y-m-d H:i:s', strtotime('-15 minutes', strtotime(date('Y-m-d H:i:s')))); $offline = date('Y-m-d H:i:s', strtotime('-30 minutes', strtotime(date('Y-m-d H:i:s')))); if(strtotime($timestamp) >= $online){ return 'online'; } else...

JSON Date Formatting

jquery,json,date
I'm having an issue with the date format when getting JSON Date/Time. I've managed to get the date format to: 2009-06-25T17:32:10.0000000 But I need to be: 25/06/2009 17:32:10 But since I'm getting this data from a loop I've trouble finding out how exactly to format the date so that the...

INDEX/MATCH for closest value to a certain date

excel,date,excel-formula,worksheet-function,array-formulas
In sheet "Dividends" I have a table with dividends sorted by daily dates. E.g, columns A and B contain the following entries: 6/14/2015 6/13/2015 6/12/2015 0.045 6/11/2015 6/10/2015 This means that the stock paid a dividend of 0.045 on 6/12/2015. In another sheet "AdjClose", I have a table with weekly...

How to most efficiently convert a character string of “01 Jan 2014” to POSIXct i.e. “2014-01-01” yyyy-mm-dd

regex,r,date,posixct
I already have a partial answer to the problem here, which I understand as far as it is explained: How to most efficiently restructure a character string for fasttime in data.table However, the task has been extended, and needs to deal with a variation of the orginal formatting. I have...

Retrieve the date portion of date object in milliseconds

javascript,date,datetime,angular-ui-bootstrap,milliseconds
How can I get the date portion of a Date object in milliseconds in javascript? I didn't find any method to this. I was trying: var today = new Date(); var datePortion = today.toDateString(); var inMiliseconds = new Date(datePortion).getMilliseconds(); console.log(inMiliseconds); The return is always 0. See jsFiddle. What can I...

Java Date “before” method dont exist [on hold]

java,date,netbeans
I have imported import java.util.*; import java.util.Date; but NetBeans shows that method "before" dont exist. Data2 is taken from the input, "current" from current day. Date now = new Date(); SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd" ); String current = formatter.format( now ); String data2 = data.getText(); boolean result =...

Selecting between dates in mysql

mysql,date
Need to track and bill delivers based on date, for example if a deliver came in After 01/18/2010 but before 02/11/2010 it would be billed to Job no. 198. I pretty much know it would be: SELECT `no` FROM `jobs` WHERE 'start_date' >'2010-01-18' AND <`2010-02-11`; in order to get '2010-01-18'...

SQL stored procedure: increment months from a starting date to an end date

sql-server,tsql,date,stored-procedures,cursor
I'm trying to create a stored procedure in SQL Server that basically increments the months from a given start date up to a given end date and updates them into a predefined table. Problem: Somewhat like this: Exec MonthRunner @Start ='2014-01-01', @End = '2014-06-01' Should give me a table like...

How to change date-time format?

sql-server,date,datetime,sql-server-2014
I have a RegDate column of nvarchar(max) type in my table in which dates are stored in mm/dd/yyyy (5/22/2015 11:09:39 PM) and dd-mm-yyyy (19-05-2015 22:55:05) format. I want to get all these entries in one format i.e. dd/mm/yyyy. I tried to convert it by using Convert(varchar(10),cast(vr.RegDate as DATETIME),105) as RegistrationDate...

Can someone explain this odd javascript date output?

javascript,date,datetime,time
https://jsfiddle.net/8cvhnwgs/1/ //new Date(year, month, day, hours, minutes, seconds, milliseconds) $("#out").html(new Date(2015, 5, 31, 08, 25, 30, 0)); The date I give is May 31st, but it outputs July First, can someone explain why? Have I used arguments wrong?...

Format date (with different input) php

php,date,format,multilingual,jquery-validation-engine
I am working on a multilingual formular and have to solve a date formatting problem: In German the date format is: DD-MM-YYYY While in another country e.g. England the date format is: YYYY-MM-DD While this input validation is handled right, I need to get a easy solution for my php...

SQL Server / C# : Filter for System.Date - results only entries at 00:00:00

c#,asp.net,sql-server,date,gridview-sorting
I have a connected SQL Server database in Visual Studio and am displaying its content in a grid. I created a dropdown menu with the column names as selectable options and a text field to filter for specific content, e.g., DropDown = "Start" - Textfield = 14.03.2015 = Filter Column...

So I'm tring to get a date as a string at the command line and convert it into milliseconds but it keeps adding five hours. Any ideas why?

java,parsing,date,simpledateformat
This code works but when it converts the input into milliseconds it adds five hours. Is there a fix for this? ArrayList<String> timeList = new ArrayList<String>(); Scanner in = new Scanner(System.in); System.out.println("Please enter time you arrived (HH:mm:ss): "); timeList.add(in.next()); SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss"); String arriveTime = timeList.get(0); try{ Date...

How to format the given time string and convert to date/time object

java,date,datetime,datetime-format
I am getting the time object in the form of a string from a rest service . I need to extract the time and then do some time operation.The given time string is "2015-06-16T14:58:48Z". I tried the below code , to convert the string to the time , however ,...

Format Date VARIABLE to short date VBA

vba,date,time
I have a user inputted via a userform.textbox.value. General date that I want to switch to a short date. (Or try to get the time to drop so it reads 00:00). I tried the code sDate=format(date,(d)) but that returns the current date rather than the variable date without the time....

java.text.ParseException: Unparseable date: “01-02-2014”

java,date
I am newbie with servlet and jsp. I am trying to insert date into table with more information. This is my code try{ DateFormat sdf = new SimpleDateFormat("dd/MM/yyyy",Locale.ENGLISH); Date reg=sdf.parse(request.getParameter("dob")); } catch(ParseException e) { e.printStackTrace(); } When I am debugging and control reaches to this line it throws an error...

Excel VBA's Date() function acting up

excel-vba,date
VBA is complaining about something but I don't know what that is. My code: Sub datesnstuff() Const today = Now() Const yesterday = Date(Year(today),Month(today),Day(today) - 1) End Sub And it gives me the following error: Compile error: Expected: ) I think it is clear what I want it to do,...

How to set current date with HTML input type Date Tag

php,html,date
I am new in php and i want to set current date in my HTMl date tag <input type="date" value="Today"> How i can get current date?...

disable past dates and to-date duration to three month

javascript,angularjs,twitter-bootstrap,date,bootstrap-datetimepicker
I have created an application for getting a calendar using angularjs, I have used angular-bootstrap-datetimepicker plugin for achieving that. The application is working fine but the issue is that I want to disable all the pass dates apart from the current date as well as only three months should be...

AppleScript (or swift) add hours to time

swift,date,applescript
I'm trying to add 8Hours to a date (from the clipboard) set date1 to the clipboard set newdate to date1 + (8 * hours) display dialog "Purchases were downloaded at " & newdate buttons {"OK"} default button 1 But this is not working as expected, I'm having the error Can’t...

SAS Macro to Combine Municipal Proc SQL Statements Based on Date Criteria

date,sas,sas-macro
I have a series of proc sql statements which pull data for Active, Inactive and Lapsed customers. I end up with 3 tables. *Customers_Active *Customers_InActive *Customers_Lapsed Active: 0-12M purchaser Inactive: 13-24M purchaser, did not purchase 0-12M (active day range minus 12 months) Lapsed: 25-36M purchaser, did not purchase 0-24M (inactive...

I need to dynamically set the date in a where statement to only pull results from a table to occur in County's fiscal year

sql,sql-server-2008,date,datetime,visual-studio-2008
Here is my current code: SELECT nature, inci_id, calltime, agency, gp FROM inmain AS inmain WHERE (calltime >= CONVERT(DATETIME, '2013-07-01 00:00:00', 102)) AND (calltime <= CONVERT(DATETIME, '2014-06-30 23:59:59', 102)) ORDER BY nature, calltime I need this to pull data at the end of every fiscal year without going in and...

sqlite Select specific day of specific month and none specific month

sql,sqlite,date,timestamp
What I am trying to do is to select a specific month and a specific day from a timestamp. What I have tried is this: SELECT t FROM test WHERE t BETWEEN '2015-08-01 00:00:00' AND '2015-08-01 23:59:59'; with 8 being the specifc month and 1 being the specific day but...

Convert March 2015 to 03/2015 and make into date

mysql,date
I have a column which holds values in the format 'June 2015', 'July 2015', 'March 2014', 'February 2016'. I need to convert these into the format 06/2015, 07/2015, 03/2014, 02/2016.. but also make them a date so I can sort by this column. I currently have the following select: SELECT...

using while loop not looping through date properly [on hold]

sql,sql-server,date
i have query like this : declare @currentDate datetime,@enddate datetime; set @currentDate = '06/1/2015'; select @enddate='06/05/2015' while @currentDate < @enddate begin select @currentDate = dateadd(DAY,1,@currentDate); select @currentDate as currentdate end but in the result set this is not showing my current date.it s showing date from 2015-06-02 on wards..i want...

date range validation is valid if 'to date' not in same month as 'from date'

javascript,angularjs,date,momentjs
I have search date range 'from date' & 'to date' my validation function make data valid if range of date is not in same month ? for example if from date"2015-06-02" to date "2015-06-01" the range is invalid range? but if I make the to date "2015-05-31" it will be...

Date regex python

python,regex,date
I am trying to match dates in a string where the date is formatted as (month dd, yyyy). I am confused by what I see when I use my regex pattern below. It only matches strings that begin with a date. What am I missing? >>> p = re.compile('[A-z]{3}\s{1,}\d{1,2}[,]\s{1,}\d{4}') >>>...

Count Down 1 Day for Each Row mysql

mysql,date
I added a column to my mysql table called dateAdded which should hold a time value for each row. I want to add a time value into each row in the column, but I want it to count down by one day. I used: UPDATE products set dateAdded=DATE_ADD('2015-06-15 11:31:31', INTERVAL...

Excel VBA InputBox value is not a date

excel,vba,excel-vba,date,user-input
I have a user input box where you type in a string, annoyingly this string looks like a date 00/00/0000 and excel reformats it as such. When the value can't be a date ex. 18/19/4561 (month can't be 18 or 19) it displays it correctly. But whenever it can be...

need the way to put Date in Parse.com without Time and the opposite

android,date,time,parse.com
Can't figured how to put just Date or just Time to Parse.com. Even after SimpleDateFormat the Date objects transferring with full default missing data. Code samples: DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); DateFormat timeFormat = new SimpleDateFormat("HH:mm"); try { date = dateFormat.parse(mDate.getText().toString()); time = timeFormat.parse(mTime.getText().toString()); } catch (java.text.ParseException e) { ......

mongodb date not matching with the given value

php,mongodb,date,mongodate
While inserting data into mongodb collection I enter the date as '20-06-2015' and then convert it to mongo format using: new MongoDate(strtotime(ClearContent(date("Y-m-d",strtotime($start_date))))); But now when I check in database it shows this: ISODate("2015-04-19T18:30:00.000Z") Why does it take the date of yesterday....

Formatting dates in an MVC Dropdown

date,model-view-controller,html-select
I have a dropdown list on my page as so: - @Html.DropDownList("dd_dates", new SelectList(@Model.seasonDates), "Please Select") where seasonDates is an IList of dates. The problem is that when the dates are displayed in the dropdown they also have the time on them as well. How do I format the display...

How to get dates between two dates

php,date
List of Dates between my From and Two <?php $scheduleStartDate = 2015-06-20; $scheduleEndDate = 2015-06-25; $Date = getDatesFromRange($scheduleStartDate,$scheduleEndDate); $Date = substr($Date, 0, -1); function getDatesFromRange($start, $end){ $dates = array($start); $Value = ''; while(end($dates) < $end) { $dates[] = date('Y-m-d', strtotime(end($dates).' +1 day')); $Value .= '"'.date('j-n-Y', strtotime(end($dates).' +1 day')).'",'; } return...

How to validate an input date from individual day, month, year input in Laravel 5

php,date,laravel-5
I have a user registration form which takes input birth day split in 3 different input fields i.e. day, month, year {!! Form::selectMonth('month', null) !!} {!! Form::selectRange('day', 1, 31, null) !!} {!! Form::selectYear('year', Carbon\Carbon::now()->year, (new Carbon\Carbon('100 years ago'))->year, null) !!} In the backend I have modified the Registrar.php/validator() to check...

Create a variable Date in format “yyyy-mm-dd”

java,sqlite,date,jdbc
I am trying to insert to my table, a date in format "yyyy-mm-dd". My table has a field date type DATETIME and I use SQLite DB SYSTEM. I need to be in this format, so later to have the option to select dates from - then. My table: CREATE TABLE...

How to set day of the week in Bulgarian language

php,date
I have to show tomorrow's day of the week in Bulgarian. It is shown in English, how do I set it in Bulgarian? <?php $now= new DateTime('now'); $date=$now->modify('+1 day'); echo $date->format('l'); //prints Saturday I did this with an array of Bulgarian names of days and it works, but is there...

Using date in CreateQueryDef

vba,date,ms-access
I have a table on which I run a query that I export to Excel. Here is an example: Table: Food Item | Price | Limit_Date | ------------------------------- Carrot | 0.80 | 08/07/2015 | Salmon | 4.30 | 01/07/2015 | Biscuits | 2.40 | 15/12/2015 | Milk | 1.00 |...

What are valid input DATE formats for the (Linux) date command?

linux,bash,date,scripting
The following command generates the date for the next day: date -d "20150615 12:00 +1 day" +%Y%m%d 20150616 I would like to specify my own INPUT date format, such as: 2015_06_15 But the date command does not like this format and complains about invalid date: date: invalid date '2015_06_15 12:00...

Get dates in “human readable” format

php,symfony2,date,fosrestbundle
I am working in a RESTFul API using Symfony2 and FOSRestBundle. The entities use Gedmo for Timestampable options: use Gedmo\Timestampable\Traits\TimestampableEntity; And I get the createdAt as any other column: $obj->getCreatedAt() Then I pass that response to FOSRestBundle: $respEmail = [ "id" => (string)$entEmail->getId(), ... "category" => $entEmail->getEmailsCategory(), "createdAt" => $entEmail->getCreatedAt()...

Creating javascript dates object

javascript,date,object
I am trying to create an object with all the dates from "today" until 60 days from now. My code: var dates = []; getDateRange(); function getDateRange() { var today = new Date(); var date = new Date(); for (var i = 0; i <= 59; i++) { date.setDate(today.getDate()+i); console.log(date);...

convert date format in php [duplicate]

php,mysql,date
This question already has an answer here: Convert one date format into another in PHP 9 answers Convert date format yyyy-mm-dd => dd-mm-yyyy 11 answers I would like to know how to convert 2015-06-15 to June 15, 2015 in PHP This is essentially the format that it is stored...

Get next month using mktime()

php,date,mktime
I'm trying to get the next month using PHP mktime() function. I am looking to get a result like 07/2015 but instead it is giving me 01/2015. Here is the code I am using: $next_month = strftime('%d/%Y', strtotime('+1 month', mktime(0,0,0,$month,1,$year))); The value of $month is 06. The value of $year...

Convert Strings To Date In VBA In A for Each Loop

string,excel,vba,date
I Have a column with dates as string like 15/06/2015, but the type is string, and at the same column I have real dates types, my problem is that when run the code the erro "no matches variables" here is my code. Sub arrumadata3() Application.ScreenUpdating = False Sheets("Plan1").Activate For Each...

Using VLOOKUP formula or other function to compare two columns

mysql,excel,vba,date
I have one table like this: SHORT TERM BORROWING 1/6/2009 94304 12/31/2010 177823 6/30/2011 84188 12/31/2011 232144 6/30/2012 94467 9/30/2012 91445 12/31/2012 128523 3/31/2013 83731 6/30/2013 78330 9/30/2013 70936 12/31/2013 104020 3/31/2014 62345 6/30/2014 62167 9/30/2014 63494 12/31/2014 104239 3/31/2015 69056 I have another column which lists each date from...

oracle sql - finding entries with dates (start/end column) overlap

sql,oracle,date,range
So data is something like this: ID | START_DATE | END_DATE | UID | CANCELED ------------------------------------------------- 44 | 2015-10-20 22:30 | 2015-10-20 23:10 | 'one' | 52 | 2015-10-20 23:00 | 2015-10-20 23:30 | 'one' | 66 | 2015-10-21 13:00 | 2015-10-20 13:30 | 'two' | There are more than...

how to add Hours to date in swift in this format “2015-06-11T00:00:00.000Z” as in one string while parsing in SWIFT

ios,iphone,swift,date,nsdate
How to add Hours to date in swift in this format "2015-06-11T00:00:00.000Z" as in one string while parsing in SWIFT. I was trying to add time to date in ons string for parsing in SWIFT. I have two texfields representing date and time from the date picker, but when I...

Regex pattern for date and hour

regex,date,time
I want to use regex to validate text fields in JSF. Could someone tell me the pattern for hours (hh: mm) and date (dd / mm / yyyy). I tried the following patterns, but without knowing anything. <f:validateRegex pattern="[0-9][0-9]:[0-9][0-9]" /> <f:validateRegex pattern="[0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]" /> ...

PHP Date Comparison Not Working

php,date
I'm trying to understand why this code works: <?php // $today = date("d/m/Y"); $today = date("Y-m-d"); $today_dt = new DateTime($today); foreach ($records as $record) { } ?> <tr> <?php $dueDate = date("Y-m-d", strtotime($record->getField('Due Date'))); ?> <td><?php echo 'today is: ' . $today; ?></td> <td><?php echo 'expiry date is: ' ....

Is there a single DateTime Picker component for gwt?

java,date,datetime,gwt
I need to use a single date time picker component. Currently, I am using DateBox but I need to pick hours also. As far as I can see, with DateBox I can specify Input Date Format like "MM/dd/yyyy/hh/mm" and I can edit the hours and the minutes with the keyboard....

Convert long int seconds to double precision floating-point value

c++,date,datetime,time,converter
I have a long int variable wich containes seconds since Jan. 1, 1970 in this format: long int seconds = 1231241242144214; i need to convert this seconds to double precision floating-point value. The integer part of the value is the number of days since midnight, 30 December 1899. The fractional...

ACCESS 2007 - Form / subform filtering between dates

vba,date,ms-access,filter
In ACCESS 2007 I have a main form with two unbound comboboxes named cmbStavOd and cmbStavK, both formatted as Short Date. I have a subform named frm_qryNaklady_subform, based on a query with a field named datNakladDatum (textbox name datNakladDatum), formatted as Short Date. I'd like to allow users to enter...

comparing two dates. Equal isn't working as well

sql,date,ms-access,compare,equals
I've got trouble with comparing two dates: There is short datetime field in database, recorded by Microsoft Access 2002-2003 data extension (#yyyy/mm/dd#). When I tried to compare via operators "greater than" and "less than" it works fine, but when I replaced with the operator "equal" it's giving me an empty...

Get n data based on the same day (timestamp)

mysql,timestamp,date
I have this table "sensor" which has these fields : id (int,PK) timestamp (timestamp) latitude (varchar) longitude (varchar) data (float) As in one query I want to get 5 rows that were on the same day. Please note that it's not current date and the data has lots of different...

NSDateFormatter doing wrong

swift,date,nsdateformatter
i'm trying to get my local date and using the NSDateFormatter to write it in the right way, but i'm getting a mix of en_US with pt_BR (portuguese - Brazil). Here the following code: let br_DateFormat = NSDateFormatter.dateFormatFromTemplate("ddMMMMyyyy", options: 0, locale: NSLocale(localeIdentifier: "pt_BR")) let date = NSDate(); var dateFormatter =...

Oracle SQL PreparedStatement setdate

java,sql,oracle,date
I'm pulling my hair off, I can't find good solution for it, I've searched some other topics, but still no ideas. I have problem with PreparedStatement, especially with setting date. I know, that oracle Date needs date in format YYYY/MM/DD and java.sql.date in YYYY-MM-DD but any of these schemes don't...

Why is R (in my example) very slow for handling dates/datetimes?

r,performance,date,datetime
I have a list of 40 dataframes with about 250k rows and I want to append a new variable to each dataframes. This new variable period is calculated from another variable which contains Date objects, the transformation is very simple, if the year part of the date is lower than...

Add days, weeks, months to date using jQuery

jquery,date
I have a form which lets the user select an invoice date and payment terms. The payment terms are; 1 week from invoice date, 4 weeks from invoice date, 1 month from invoice date, etc. When the user has selected an invoice date and the payment terms I then want...

Elasticsearch NumberFormatException when running two consecutive java tests

java,date,elasticsearch,numberformatexception,spring-data-elasticsearch
I have two test in a class, each of them containing the following query: SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(matchAllQuery()).withFilter(rangeFilter("publishDate").lt(date)).build(); In one of the tests, the number of the results elasticsearchTemplate.count(searchQuery, Article.class), in the other one the returned values are verified elasticsearchTemplate.queryForPage(searchQuery,Article.class) If I run any of these two tests separately,...

Construct date for specific day of current month and convert it to epoch

date,converter,epoch
I need epoch of 4th day of current month. I have this: START_DT=$(date +"%Y-%m-04 00:00:00") START_DT_TS=$(date -d "$START_DT" +%s) Output is 1433368800 which is expected. How I achieve this on single line?...

Show current time of most commons timezone (UTC, EDT, CEST…)

linux,bash,date
I can have UTC current time with "date -u". But i would like to print the current time of some common timezones at the same time. (UTC, EDT, CEST...) I can create a script and add severals : date -u -d 'x hour ago' But sometimes, hours change. (Like in...

Query Builder for DATE type

c#,date,query-builder
I'm having a problem with my query builder. I have a datagridview which I want to filter through. I want to allow search by "NAME, SURNAME, DATE". Here is my SQL QUERY SELECT exDate, exName, exSurname FROM examines WHERE (exDate = @Param1) AND (exName = @Param2) AND (exSurname = @Param3)...

How to change format of date and insert it in database using php and html only

php,html,mysql,date
I used this tag in html for accepting the date $date = date('d-m-Y', strtotime($_POST["date"])); I used this code for converting the date. The date is converted successfully if I simply echo it but date is not getting inserted in database. It gets posted as 00-00-0000 but if click it...

Android - At Minutes to a Time hh.mm.ss

java,android,date,time
i,ve got a problem which i cant solve at the moment. I already googled for it and found some solutions, but all of them not rly match my problem. So i get 2 Strings from SQL Database in the format hh:mm:ss. The first String is a time, for example "14:30:00"...

Convert string to ISODate in MongoDB

javascript,python,mongodb,date
I am new to MongoDB and I am stuck on the String to Date conversion. In the db the date item is stored in String type as "date":"2015-06-16T17:50:30.081Z" I want to group the docs by date and calculate the sum of each day so I have to extract year, month...

Don't understand tm_struct (C++) calculations - is there an offset of some kind? [closed]

c++,date,datetime
I can't understand why the tm struct in C++ behaves this way. Let me be more specific - if I were to get the current time, I'd probably do something like this time_t now = time(0); tm *nowTm = gmtime(&now); And upon printing out the date, I expect something like...

How to find the days b/w two long date values

javascript,jquery,date
I have two long dates value. For Ex: 1433097000000 1434479400000 Here i have to find the days between these two by jquery For Ex: 15/06/2015 - 22/06/2015 If it is more than 5 days, I want to get from is 15/06/2016, to is 19/06/2015. It is based on long values...

I had assigned Varchar for date and It's not working when I select between range of dates [closed]

sql-server,date
Create Table Table_Name([Date] Varchar(100)); Standard 105. Insert Into Table_Name Values('18-01-2015'); Insert Into Table_Name Values('19-01-2015'); Insert Into Table_Name Values('20-01-2015'); Insert Into Table_Name Values('21-01-2015'); Insert Into Table_Name Values('22-02-2015'); Insert Into Table_Name Values('22-03-2015'); Insert Into Table_Name Values('22-04-2015'); Insert Into Table_Name Values('22-05-2015'); Select [Date] From Table_Name Where [Date] >= '18-01-2015' And [Date] <= '20-01-2015'...

How to Detect that user have selected date from html input date [closed]

php,html,html5,date
i am new to html and p-h-p. what i am looking for is that i have provided user an input date calendar through html date input method. Now how can i detect that user have provided date or not ... if he didn't selected date from calendar he should be...

How do I change chromes Date-parsing / Sorting to match ff/ie Dateparsing?

javascript,jquery,google-chrome,date,momentjs
So I encounter a very weird problem here and am out of ideas at the moment. I've the following function to parse and sort a json object by its property RowDate, containing datestrings with the following format: "/Date(1389682861507+0100)/". orderByDate: function (json) { debug('[DataCollection::orderByDate], json before ordering: ', json); _.each(json.LineDefinitions, function...

Can't subtract two hours in php

php,date,subtract
Im trying to subtract tow hours, this is my code (crono() subtracts two hours): include("classes/Functions.php");//contains crono() include("classes/database.php");//database connection $selectActual = "SELECT * from InfActual WHERE state='on'"; $resultActual = $conn->query($selectActual); if ($resultActual->num_rows > 0) { while ($rowActual = $resultActual->fetch_assoc()) { $horaIni = $rowActual['horaIni']; $actual = date("h:i:s"); echo "horaini: ".$horaIni." actual: ".$actual."<br>";...

Date incrementing issue in bootstrap date picker

javascript,angularjs,date,datepicker,bootstrap-datepicker
I'm using bootstrap datepicker where the date when selected ,the ng-model $scope.taskInfo.startDate contains the selected date as Mon Jun 01 2015 00:00:00 GMT+0530 (India Standard Time) ie., $scope.taskInfo.startDate = Mon Jun 01 2015 00:00:00 GMT+0530 (India Standard Time) But when I perform date manipulation on my model,the date seems to...

Group By Date and SUM int - Date formatting and Order

sql-server,date,casting,order,group
I'm trying to get the SUM of the quantity sold on a day. I need the results to be in ORDER BY date. The query below gives me the exact result I need, except the date is not formatted to what I need. SELECT CAST(Datetime AS DATE) AS 'date', SUM(quantity)...

IE Input type Date not appearing as Date Picker

internet-explorer,date,datepicker
I am using the input type DATE in my HTML and everything works fine in Chrome and Firefox, but IE does not show the date picker. When I use the JQuery Datepicker I get two date picker dialogs in Chrome and Firefox. How can I fix this where I can...

Remove leading zeros from Oracle date

sql,oracle,date
I want to output the current date in the format: 1-1-2015 So without the zero's in this example: SELECT TO_CHAR(SYSDATE, 'DD-MM-YYYY') AS today FROM dual Output: 17-06-2015 ...

MySQLi “CURRENT_MONTH_BEGINNING”… is there a way to get that?

php,date,mysqli
I am interested in collecting data from the last month in the database with MySQLi. But using INTERVAL 1 MONTH each month overlaps the other, so is there a way to tell the function to check my current month, start from the first day, and collect all data from said...

php why do i allways get a 1 on date [duplicate]

php,date,time
This question already has an answer here: A non well formed numeric value encountered 5 answers so this is weird i dont understand why i am getting this but anyway my code is $checkTime = "00:00"; echo 'Check Time : '.date('H:i', $checkTime); echo "<br>"; the value allways gets output...

How to compare two dates in moment.js [duplicate]

javascript,jquery,angularjs,date,momentjs
This question already has an answer here: Moment js date time comparison 3 answers I am using moment.js in my application, I pass my date in a particular format to moment.js and it compares it with the system time and give me the pretty time format, like this: moment(time,...

sql server query current date from database [duplicate]

sql,sql-server,date
This question already has an answer here: how to get current datetime in SQL? 6 answers I want to find few data from SQL Server that only query by current date. The purpose is to view today transaction only Here is my code SELECT * FROM dbo.Student.studentProfile WHERE TransactionDate...

rails how to save date_select field value in date field in db

date,ruby-on-rails-4
I have a date_select in my form: <%= f.date_select :birthdate, {:start_year => Time.now.year - 100} %> I have a field t.date "birthdate" How can I save the value selected in date_select to the database (@user.birthdate)? (without using any gems like datepicker)...

How can I convert a date string from Mongoose Query?

javascript,date,mongoose
My Mongoose date query return the below string: 24th Jun 2015 How to convert it to javascript date object?...

Extracting multiple variables from a changing string in bash

python,string,perl,date,datetime
I have multiple strings like that in a file, one per line: [random string] was [failed/passed] 1y 2mo 3d 1h 51m 2s ago [some string] Now what I want to do is extract the duration in 6 variables (years, months, days, hours, minutes, seconds) to calculate a date with the...

Combining time series data into a single data frame

r,date,data.frame,time-series
I have multiple data frames that look like this: > head(Standard.df) Count.S Date Month Week Year 552 15 2008-01-01 2008-01-01 2007-12-31 2008-01-01 594 11 2008-01-02 2008-01-01 2007-12-31 2008-01-01 1049 10 2008-01-03 2008-01-01 2007-12-31 2008-01-01 511 12 2008-01-04 2008-01-01 2007-12-31 2008-01-01 717 10 2008-01-06 2008-01-01 2007-12-31 2008-01-01 1744 3 2008-01-07 2008-01-01...