Questions tagged [date-comparison]

This tag refers to the process of comparing two or more dates with one another.

Use this tag for any questions related to date comparison.

327 questions
7
votes
2 answers

PostgreSql + Date Format Convert YYYY-MM-DD to Day, Date Month Year

Suppose I am storing this format in my postgre database table. Now I have to compare this date with one of the texbox value contain date in different format. Database Date Format :: YYYY-MM-DD For example :: 2010-11-26 Text-Field Date Format ::…
Rubyist
  • 6,486
  • 10
  • 51
  • 86
7
votes
2 answers

How to determine if the specific time is between given time range in javascript

i want to check var check_val in between two time var open_time and var close_time var open_time = "23:30"; var close_time = "06:30"; var check_val ="02:30"; if(Date.parse ( check_val ) > Date.parse ( open_time ) && Date.parse ( check_val ) <…
6
votes
5 answers

DateTime comparison without time part?

I wrote this code. But I want to ignore time, I want to compare only day. from s in sayac_okumalari where s.okuma_tarihi == startDate && s.sayac_id == sayac_id group s by new { date = new DateTime(((DateTime)s.okuma_tarihi).Year,…
AliRıza Adıyahşi
  • 15,658
  • 24
  • 115
  • 197
5
votes
5 answers

How to get date part (dispose of time part) from java.util.Date?

I want to compare the date part of two java.util.Date objects. How can I achieve this? I am not looking to comparing the date, month and year separately. Thanks in advance!
MozenRath
  • 9,652
  • 13
  • 61
  • 104
5
votes
3 answers

Check if date between date range that also handle null values Java

My standard method for checking if a date is between two dates in Java looks like this: public static boolean isWithinRange(Date date, Date startDate, Date endDate) { return !(date.before(startDate) || date.after(endDate)); } I want to add…
uraza
  • 907
  • 4
  • 12
  • 22
5
votes
3 answers

JavaScript date comparison fails in IE8

I have a function that converts a date to YYYY-MM-DD from DD/MM/YYYY. This works in all browsers apart from IE8, for some reason, when creating a new Date object, it is returning NaN. Basic implementation of the code http://jsfiddle.net/bX83c/1/ var…
CharliePrynn
  • 3,034
  • 5
  • 40
  • 68
5
votes
1 answer

Sum data from dates during this year using Google Spreasheets

I have a list of books I've read over the years, along with page counts, stored in Google Spreadsheets. For each book, I keep a pagecount and the date I finished the book. I'd like to sum up the pagecounts of all the books I've read this year. So…
Jenee
  • 53
  • 1
  • 4
5
votes
1 answer

Compare two dates based on year-month, taking no notice of day

I need to be able to compare two dates, only based on the year and the month (i.e. without taking notice of the day), and that in JAVA and HQL. Let's say I need to check if d1 is less than or equals d2. Here is what I…
sp00m
  • 47,968
  • 31
  • 142
  • 252
4
votes
6 answers

Compare dates from a String in list

I'm having a problem continuing. I have a list and in each position contains a String (within the phrase there is at the end a date) Example: I am new here 20/8/2019 I want to sort the list this way: In position zero I want the phrase containing…
RM.
  • 59
  • 1
  • 7
4
votes
3 answers

java - compare two date values for the month and year

I have a requirement to match two dates and if their month/year are same, i should return true, otherwise false. Based on my search, i found the following solution. Is there any other better way to do this comparison?. Calendar cal1 =…
pulikarthi
  • 127
  • 1
  • 1
  • 6
4
votes
2 answers

row wise comparison between a vector and a matrix in r

I have two datasets from 10 people. One is a vector, and the other is a matrix. What I want to see is if the first element of the vector includes in the first row of the matrix, and if the second element of the vector includes in the second row of…
Shinzi Katoh
  • 291
  • 3
  • 11
4
votes
6 answers

SQL Date Compare by only using Date not Time

This was originally going to be a question about how to implement this because I was stuck at a certain part but I am now curious as to why this was happening in the first place. I needed to compare only the dates not the time which wouldn't have…
Gage
  • 7,365
  • 9
  • 47
  • 77
4
votes
1 answer

Two identical datetimes not comparing equal

I have two dates that are identical as far as I can tell. $theDate = (Get-Date -Hour 0 -Minute 00 -Second 00) $otherDate = (Get-Date -Hour 0 -Minute 00 -Second 00) Executed in that order Both of these show up as Monday, May 11, 2015 12:00:00 AM,…
user31792
  • 43
  • 4
4
votes
1 answer

iOS detect if date is within last week

I am trying to detect is a specific date is within the last 7 days (within the last week). I have found a method to do that, but its eating my performance in a tableview (chat controller). The code is posted below, and i know it can be done a LOT…
B-Man
  • 2,209
  • 3
  • 22
  • 35
4
votes
1 answer

Query in sql server 2012 with datetime between takes too long with millisecond difference

I have a strange issue with a database and a query in sql server 2012. in the records, are one column that is of type datetime (not datetime2) and stores the values in the format 'YYYY-MM-dd HH:mm:ss.ttt' but i have a problem... if i make this…
Phoenix_uy
  • 3,173
  • 9
  • 53
  • 100
1
2
3
21 22