C
C#2y ago
NDOT

❔ compare two dates

see below RoleAssociate
12 Replies
Angius
Angius2y ago
There's nothing below
friedice
friedice2y ago
when
NDOT
NDOT2y ago
wait a second bro lol i want to compare 2 dates with c# but DateTime.Equals, will compare exactly both and i just want to compare the day/month/year, and not the hour how can i do that with dates?
Angius
Angius2y ago
You can use DateOnly struct maybe DateOnly.FromDateTime(dateTime) That'll give you just the date without the time And you can compare it like you'd normally do
NDOT
NDOT2y ago
where (dateTime) is my source date, right?
Angius
Angius2y ago
ye
MODiX
MODiX2y ago
Angius#1586
REPL Result: Success
DateOnly.FromDateTime(DateTime.Now)
DateOnly.FromDateTime(DateTime.Now)
Result: DateOnly
2023-01-24
2023-01-24
Compile: 430.050ms | Execution: 23.288ms | React with ❌ to remove this embed.
Angius
Angius2y ago
Like so
NDOT
NDOT2y ago
thanks a lot bro i'll try it when i get home
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
NDOT
NDOT2y ago
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.