does region affects the data comparision or ordering out put if i keep the same zone. RRS feed

  • Question

  • User2102072086 posted

    in asp.net core 3.0 web api

    if I keep one zone like india. and change the region to amarica or iraq, then will it affect the comparison of datetime or ordering of datetime

    that means is the calendar is the same which we generally see in "eng us"

    what I have noticed is the first weekday changes with the region.

    so I thought I should not affect the comparison and ordering because 1st of feb will always bigger than 31st of jan. in all-region.

    Tuesday, April 7, 2020 9:38 AM


  • User415553908 posted

    I presume you talk about DateFormatInfo differences? In this case, different cultures would have different settings associated with them.

    I am not sure I get the "1st of Feb being greater than 31st of Jan" paragraph - it appears you try to compare two formatted strings instead of DateTime objects. You probably should correct that to compare actual DateTimes as these represent moments in time and do not depend on culture for comparison purposes.

    One way you can eliminate this uncertainty around users culture would be to force your comparisons in a neutral culture

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 7, 2020 10:10 AM