PM time converted and shown as AM

PM time converted and shown as AM

a2ztecha2ztech Posts: 19Questions: 2Answers: 1

e.g. 17:00:00 in the DB shows up as 5:00 AM on the editor grid.

further while editing the PM time gets save as AM.

Is this something to do with windows/regional settings?

The online example https://editor.datatables.net/examples/dates/time.html
works right. But, the one downloaded on my machine does NOT?

Replies

  • allanallan Posts: 61,726Questions: 1Answers: 10,109 Site admin

    Hi,

    Are you able to give me a link to your page? It is possible there is a timezone issue, but I would have expected it to be present in my examples as well if you were seeing it locally.

    Allan

  • a2ztecha2ztech Posts: 19Questions: 2Answers: 1

    I am running .NET examples downloaded from this website as it is on my local.

    https://editor.datatables.net/examples/dates/time.html

    It works fine on the link above but NOT on my local.

    Can you guide me if there are any settings which I need to change here? This is critical for me to deliver this solution to my client. Thanks!

  • allanallan Posts: 61,726Questions: 1Answers: 10,109 Site admin

    Running the .NET version makes a difference here, and I'm afraid you've discovered a bug in my .NET demo! In the TimeController.cs there is:

                            .GetFormatter(Format.DateTime("hh:mm:ss", "h:mm tt"))
                            .SetFormatter(Format.DateTime("h:mm tt", "hh:mm:ss"))
    

    it should be:

                            .GetFormatter(Format.DateTime("HH:mm:ss", "h:mm tt"))
                            .SetFormatter(Format.DateTime("h:mm tt", "HH:mm:ss"))
    

    Note the difference in the HH rather than hh. hh is 12 hour, while HH is 24 hour, which is needed for the SQL database.

    Making that change allows it to correctly save the time.

    Thanks for letting me know about this.

    Regards,
    Allan

  • a2ztecha2ztech Posts: 19Questions: 2Answers: 1

    ohhh..k..that was painful..
    Thanks though :)

This discussion has been closed.