How to compare dateTime from my database to the method's paramater? [on hold]












-2















[HttpGet("pretraga/{date}/{grad}")]
public async Task<ActionResult<Osoba>> NadjiPoDatumuIGradu(DateTime date, string grad)
{
var osoba = await _context.Osobe.Where(o => o.datumRodjenja.ToString.Equals(date.ToString)).FirstOrDefaultAsync();









share|improve this question















put on hold as off-topic by MickyD, Michael Dodd, Nkosi, Vega, Machavity Jan 18 at 14:40


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – MickyD, Michael Dodd, Nkosi, Vega, Machavity

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 2





    Please don’t just post code.

    – MickyD
    Jan 18 at 14:12






  • 2





    Could you provide more details about the problems with this code?

    – Marcin Topolewski
    Jan 18 at 14:12











  • What sort of comparison? UTC?

    – MickyD
    Jan 18 at 14:15











  • I want to compare dateTime of person from my Osobe database to the one in the arguments. Search function that returns person using their date of birth. So if there is a person that birth date is 23/06/1998 if i put that in get by date,it should return that person

    – Veljkoza
    Jan 18 at 14:38


















-2















[HttpGet("pretraga/{date}/{grad}")]
public async Task<ActionResult<Osoba>> NadjiPoDatumuIGradu(DateTime date, string grad)
{
var osoba = await _context.Osobe.Where(o => o.datumRodjenja.ToString.Equals(date.ToString)).FirstOrDefaultAsync();









share|improve this question















put on hold as off-topic by MickyD, Michael Dodd, Nkosi, Vega, Machavity Jan 18 at 14:40


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – MickyD, Michael Dodd, Nkosi, Vega, Machavity

If this question can be reworded to fit the rules in the help center, please edit the question.









  • 2





    Please don’t just post code.

    – MickyD
    Jan 18 at 14:12






  • 2





    Could you provide more details about the problems with this code?

    – Marcin Topolewski
    Jan 18 at 14:12











  • What sort of comparison? UTC?

    – MickyD
    Jan 18 at 14:15











  • I want to compare dateTime of person from my Osobe database to the one in the arguments. Search function that returns person using their date of birth. So if there is a person that birth date is 23/06/1998 if i put that in get by date,it should return that person

    – Veljkoza
    Jan 18 at 14:38
















-2












-2








-2








[HttpGet("pretraga/{date}/{grad}")]
public async Task<ActionResult<Osoba>> NadjiPoDatumuIGradu(DateTime date, string grad)
{
var osoba = await _context.Osobe.Where(o => o.datumRodjenja.ToString.Equals(date.ToString)).FirstOrDefaultAsync();









share|improve this question
















[HttpGet("pretraga/{date}/{grad}")]
public async Task<ActionResult<Osoba>> NadjiPoDatumuIGradu(DateTime date, string grad)
{
var osoba = await _context.Osobe.Where(o => o.datumRodjenja.ToString.Equals(date.ToString)).FirstOrDefaultAsync();






c# datetime search get






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 18 at 14:11









MickyD

10.6k63252




10.6k63252










asked Jan 18 at 14:06









VeljkozaVeljkoza

11




11




put on hold as off-topic by MickyD, Michael Dodd, Nkosi, Vega, Machavity Jan 18 at 14:40


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – MickyD, Michael Dodd, Nkosi, Vega, Machavity

If this question can be reworded to fit the rules in the help center, please edit the question.




put on hold as off-topic by MickyD, Michael Dodd, Nkosi, Vega, Machavity Jan 18 at 14:40


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – MickyD, Michael Dodd, Nkosi, Vega, Machavity

If this question can be reworded to fit the rules in the help center, please edit the question.








  • 2





    Please don’t just post code.

    – MickyD
    Jan 18 at 14:12






  • 2





    Could you provide more details about the problems with this code?

    – Marcin Topolewski
    Jan 18 at 14:12











  • What sort of comparison? UTC?

    – MickyD
    Jan 18 at 14:15











  • I want to compare dateTime of person from my Osobe database to the one in the arguments. Search function that returns person using their date of birth. So if there is a person that birth date is 23/06/1998 if i put that in get by date,it should return that person

    – Veljkoza
    Jan 18 at 14:38
















  • 2





    Please don’t just post code.

    – MickyD
    Jan 18 at 14:12






  • 2





    Could you provide more details about the problems with this code?

    – Marcin Topolewski
    Jan 18 at 14:12











  • What sort of comparison? UTC?

    – MickyD
    Jan 18 at 14:15











  • I want to compare dateTime of person from my Osobe database to the one in the arguments. Search function that returns person using their date of birth. So if there is a person that birth date is 23/06/1998 if i put that in get by date,it should return that person

    – Veljkoza
    Jan 18 at 14:38










2




2





Please don’t just post code.

– MickyD
Jan 18 at 14:12





Please don’t just post code.

– MickyD
Jan 18 at 14:12




2




2





Could you provide more details about the problems with this code?

– Marcin Topolewski
Jan 18 at 14:12





Could you provide more details about the problems with this code?

– Marcin Topolewski
Jan 18 at 14:12













What sort of comparison? UTC?

– MickyD
Jan 18 at 14:15





What sort of comparison? UTC?

– MickyD
Jan 18 at 14:15













I want to compare dateTime of person from my Osobe database to the one in the arguments. Search function that returns person using their date of birth. So if there is a person that birth date is 23/06/1998 if i put that in get by date,it should return that person

– Veljkoza
Jan 18 at 14:38







I want to compare dateTime of person from my Osobe database to the one in the arguments. Search function that returns person using their date of birth. So if there is a person that birth date is 23/06/1998 if i put that in get by date,it should return that person

– Veljkoza
Jan 18 at 14:38














1 Answer
1






active

oldest

votes


















-1














One of the simplest approach for this could be to covert the both date-times in milliseconds using some built-in function then simply compare both as integer values.






share|improve this answer



















  • 2





    About as vague as the question. Why convert to Int when a perfectly good DateTime is available?

    – MickyD
    Jan 18 at 14:18













  • @MickyD I am aware DateTime is available. but you have built-in support for comparing dates then It is okay. If you don't have such then It becomes easy to compare integer values instead of object(depends upon programming language support )

    – Ganesh Kakade
    yesterday













  • Well this isn’t the 80’s and “built-in support” for C# ”is available”

    – MickyD
    yesterday




















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









-1














One of the simplest approach for this could be to covert the both date-times in milliseconds using some built-in function then simply compare both as integer values.






share|improve this answer



















  • 2





    About as vague as the question. Why convert to Int when a perfectly good DateTime is available?

    – MickyD
    Jan 18 at 14:18













  • @MickyD I am aware DateTime is available. but you have built-in support for comparing dates then It is okay. If you don't have such then It becomes easy to compare integer values instead of object(depends upon programming language support )

    – Ganesh Kakade
    yesterday













  • Well this isn’t the 80’s and “built-in support” for C# ”is available”

    – MickyD
    yesterday


















-1














One of the simplest approach for this could be to covert the both date-times in milliseconds using some built-in function then simply compare both as integer values.






share|improve this answer



















  • 2





    About as vague as the question. Why convert to Int when a perfectly good DateTime is available?

    – MickyD
    Jan 18 at 14:18













  • @MickyD I am aware DateTime is available. but you have built-in support for comparing dates then It is okay. If you don't have such then It becomes easy to compare integer values instead of object(depends upon programming language support )

    – Ganesh Kakade
    yesterday













  • Well this isn’t the 80’s and “built-in support” for C# ”is available”

    – MickyD
    yesterday
















-1












-1








-1







One of the simplest approach for this could be to covert the both date-times in milliseconds using some built-in function then simply compare both as integer values.






share|improve this answer













One of the simplest approach for this could be to covert the both date-times in milliseconds using some built-in function then simply compare both as integer values.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 18 at 14:12









Ganesh KakadeGanesh Kakade

64




64








  • 2





    About as vague as the question. Why convert to Int when a perfectly good DateTime is available?

    – MickyD
    Jan 18 at 14:18













  • @MickyD I am aware DateTime is available. but you have built-in support for comparing dates then It is okay. If you don't have such then It becomes easy to compare integer values instead of object(depends upon programming language support )

    – Ganesh Kakade
    yesterday













  • Well this isn’t the 80’s and “built-in support” for C# ”is available”

    – MickyD
    yesterday
















  • 2





    About as vague as the question. Why convert to Int when a perfectly good DateTime is available?

    – MickyD
    Jan 18 at 14:18













  • @MickyD I am aware DateTime is available. but you have built-in support for comparing dates then It is okay. If you don't have such then It becomes easy to compare integer values instead of object(depends upon programming language support )

    – Ganesh Kakade
    yesterday













  • Well this isn’t the 80’s and “built-in support” for C# ”is available”

    – MickyD
    yesterday










2




2





About as vague as the question. Why convert to Int when a perfectly good DateTime is available?

– MickyD
Jan 18 at 14:18







About as vague as the question. Why convert to Int when a perfectly good DateTime is available?

– MickyD
Jan 18 at 14:18















@MickyD I am aware DateTime is available. but you have built-in support for comparing dates then It is okay. If you don't have such then It becomes easy to compare integer values instead of object(depends upon programming language support )

– Ganesh Kakade
yesterday







@MickyD I am aware DateTime is available. but you have built-in support for comparing dates then It is okay. If you don't have such then It becomes easy to compare integer values instead of object(depends upon programming language support )

– Ganesh Kakade
yesterday















Well this isn’t the 80’s and “built-in support” for C# ”is available”

– MickyD
yesterday







Well this isn’t the 80’s and “built-in support” for C# ”is available”

– MickyD
yesterday





Popular posts from this blog

Homophylophilia

Updating UILabel text programmatically using a function

Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage