Which format of the date/time string could be considered mix-platform, mix-database, universal safe?
YYYY-MMM-DD HH:MM:SS be looked at dependable in MySQL, SQLite 2 &lifier 3, MsSQL along with other common databases?
What about something similar to
Whenever you can, you need to pass and store dates utilizing a real date/time type. Strings will frequently create problems when the culture changes (and most likely on different database platforms, too).
In case your language or database library enables you to employ strongly typed parameters inside your database queries, that might be the most secure method of doing this. If you are using to start dating ?Ortime type for the posts and pass the values making use of your language's date/time type, the library will make certain that the dates are handled properly.
You do not have genuinely have a "safe" DateTime. Everything is dependent on Cultures, United kingdom is DD/MM/YYYY HH:MM:ss US is MM/DD/YYYY HH:MM:ss or whatever unsure of whether it really is or otherwise but nontheless it's different.
I'd just stick to your "culture", and become consistent throughout you code so furture designers can easilly read you code with determining what type of crazy convention you've for the data and time.
Hope this can help :)
You can choose a defined standard, like the ISO standard for date and times. It's pretty universal and simple to use and understand, so that as a precise standard you can easily say "all datetimes should be ISO 8601" and that would be that. Donβt worry about locale or cultural confusion.
You need to use the ISO standard - YYYY-MM-DDThh:mm:ss[.mmm]
Or as a substitute YYYYMMDD.