Time on win2.jodoshared.com - 12 hour and not 24 hour?

Daze

Perch
Is the system clock on win2.jodoshared.com set to work with a 12 hour time rather than the usual 24 hour time?

I've notice times are being written to my MSSQL database as 02:15 (for 15:15) etc, and it's screwing up some of my ORDER BY statements. I've never worked with anyhting other than the 24 hour system before. Should I be able to work around it by inserting AM/PM when working with DateTimes in MSSQL?

E.g. UPDATE foobar SET CurrentDate='04/22/2004 07:41 PM'
 
ORDER BY should work correctly regardless of format, unless you are using a text field for the date/time instead of a datetime field.

I recommend you use ISO 8601 format at all times when inserting dates into your database: YYYY-MM-DD HH:MM:SS (24 hour notation). It's the least ambiguous format, and even plaintext sorting methods would work on it.
 
Thanks for the reply SubSpace.

I'm currently using 'MM/DD/YYYY hh:mm:ss' to insert a DateTime into my tables. However, I'm finding that 10:15am and 10:15pm (for example) are both returned as 10:15am when I retrieve the data. Weird!

I've just changed my code to use ''MM/DD/YYYY hh:mm:ss tt', and it appears to be working. I'll test it a little more... I've never experienced this before, but I must admit that all of my previous sites/applications were UK based.
 
Back
Top