I have a code that places the time into a database in the format Year-Month-Date Time. The time isnt in Pm or Am. I want to change the code from that into Month/Day/Year and the time in am or pm. Is this possible? Or should I be using a different method to placing the date into the database?
garyjohnson
14
Junior Poster
Recommended Answers
Jump to PostKeep the Y-m-d H:i:s format as you can sort on this. Month/Day/year is difficult to sort. You can run a plethora of php date functions to get the format you want when you need to display. Alternatively, you could write SQL to return the date time in the format required. …
Jump to PostTHE db is not supposed to be human readable,
it is meant for the machine to read
date stored as a timestamp, is smaller more efficient and faster, not so much for a few records, but it makes a large difference to use a four byte timestamp to a 25 …
All 5 Replies
diafol
almostbob
866
Retired: passive income ROCKS
diafol
commented:
agreed
+14
diafol
garyjohnson
14
Junior Poster
diafol
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.