View Full Version : timestamp

03-29-2007, 12:59 AM
in my database i want to be able to add the current time and date in a field and manipulate it to DD/MM/YYYY @ HH:MM:SS, for examples sake lets say i wanted to say
"You joined this site on 28/3/07 11:57:47 am || 23:57:47"
either 12 or 24 hour is fine, but can i store it like that, and it be fine.
then pull it out and say, you have been with us on domain.com for 2 years 3 months 2 weeks 4 days 15 hours and 20 seconds

03-29-2007, 06:24 AM
you would store a timestamp as yyyymmdd hhmmss and use DATE_FORMAT to display it.

as for your question about number of days, months years etc. you would use datediff or to_days to calculate the number of days that have passed and then use the modulus operator to break those down further. you would then calculate the hours and minutes separately.