Questions tagged [datetime-comparison]
102 questions
3
votes
2 answers
How to compare LocalDate with ZonedDateTime in js-joda?
I'm looking for a way to compare instances of LocalDate and ZonedDateTime in js-joda, but those classes are not compatible. I'm willing to accept, that LocalDate is a ZonedDateTime with time and timezone set to zero.
What would be the easiest way to…

Slava Fomin II
- 26,865
- 29
- 124
- 202
3
votes
2 answers
SQL Server Time Comparison with Time over midnight
I have a table in SQL Server which stores Start_Time (Time (7)) and End_Time (Time (7)).
The values stored in it are
Start_Time End_Time
15:00:00.0000000 01:00:00.0000000
I have a query which should…

user2561997
- 443
- 1
- 6
- 18
2
votes
1 answer
Compare date part in where clause
When tried to condition the where statement to only compare the date part of the datetime field using this code,
var list = products.Where(x => ((DateTime)x.PurchaseDate).Date >= dt_SelectDate.Value.Date);
I used the (DateTime) conversion because…

Mustafa Magdy
- 1,230
- 5
- 28
- 44
2
votes
1 answer
How to check for this Date Time Pattern if some minutes are over for Java Android
I receive this Date Time pattern from Server as a string.
Sa. 07.01.2023 16:39:15
Now i want to check if 1 minute is over.
Like if the gap between the current time and the time (received as a string) from server is
longer than a minute.
The time…

DealZg
- 136
- 1
- 3
- 14
2
votes
1 answer
How do I determine if a time entered into a text field falls within the range of two pre-established opening and closing times?
The opening and closing hours for the company are 8am to 10 pm. The code below seems to add 4 hours on to whatever time is entered into the text field. So if I change the opening time to 11:59 I get the correct 8 am start date, but it's not possible…

Gleaty
- 21
- 1
2
votes
3 answers
How to compare the datetime of format "EEE MMM dd HH:mm:ss zzz yyyy" and "yyyy-MM-dd hh:mm:sss" in java?
I have date of type "EEE MM DD HH:mm:ss zzz yyyy" (Wed Mar 04 03:34:45 GMT+08:00 2020) and "yyyy-MM-dd hh:mm:ss" (2020-02-04 02:10:58).How to compare this two date in java?
Both dates are in same timezone.

Pravin Pundge
- 64
- 1
- 6
2
votes
2 answers
java.time.LocalDateTime error with my program
I am having an issue with my code not displaying the correct or desired output. Here is my code that I wrote up.
import java.time.LocalDateTime;
public class DriversLicense
{
private String name;
private int id;
private int expYear;
…

pro5476
- 33
- 1
- 6
2
votes
2 answers
Missing something obvious when it comes to comparing dates (Android Date)
I have put together a method that is supposed to check if a given date is within a certain lower and upper limit.
It shouldn't consider the time, only the dates. It seemed to be a quite simple task but I am getting some strange behavior when…

WiserTheBassist
- 49
- 1
- 6
2
votes
1 answer
DateTimeComparator behavior inconsistent with its javadoc
I wanted to compare only the dates of two org.joda.time.DateTime values, so I was using the DateTimeComparator.getDateOnlyInstance() - but I saw some behavior that does not match with its javadoc. I wonder if someone here can explain that. The…

Ajoy Bhatia
- 603
- 6
- 30
2
votes
1 answer
Google Spreadsheet comparison using TIME function for 10:40:00 fails
I'm having a problem when comparing cells with value 10:40:00 to the result of the spreadsheet function TIME(10,40,0)
A series of comparisons shows that values from 8:40 to 10:39:59 and from 10:40:01 to 13:40:00 compare correctly but 10:40:00…

Ian MacColl
- 21
- 1
2
votes
5 answers
Javascript Comparing Time not working
I am trying to check if a specific ISO DateTime is before 18:00
This is the simple code:
// Define the date I want to check
var targetDate = "2015-02-04T13:30:00Z";
// Parse the string into a date object
var target = new…

Ronny vdb
- 2,324
- 5
- 32
- 74
2
votes
2 answers
C# Check if a minute between two date times
Im struggling to check if there is at least a minute between two date times. I created a game in c# and have limited a part of my game to once a minute every time this command is
executed it runs a void
The problem is that it does it even if it…

Ash Smith
- 335
- 1
- 4
- 6
2
votes
2 answers
Comparing a UTC time with a Local Time in C#
I have an Windows Console application in C# which need to compare current time with two times stored in DB. Date and Time converted to UTC before inserting into DB.
Now, I need to fetch those values and compare only time part with local time. Let…

Sai
- 159
- 1
- 9
2
votes
3 answers
Comparing C# datetime value to SQL Server Compact 4 datetime
I'm building an application that stores a group of datetimes to keep track of when I print a particular report. The report is built up of information from a second table that also has datetimes. I'm trying to get the report to populate a…

Josh C.
- 389
- 1
- 5
- 17
2
votes
1 answer
activerecord comparing times
i am trying to do a query that will be compare the time stored in the database to the current time, and if it is greater than today to display those records.
below is query i am currently using that isnt displaying any records
@schedules =…

Boss Nass
- 3,384
- 9
- 48
- 90