1
marcan
The date format in MySQL
  • 2003/12/15 19:38

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


I'm developping a little app that reads data in the XOOPS database. I'm new with my MySQL and I have a little problem with the date format. All the date field seemd to be of the type int(10) For exemple, in the xoops_stories table, I need to read the created field. What is the function in MySQL that would allow me to retrieve this value in a date/time format? I know it isn't a 100% related to XOOPS but I would really appreciate if someone could help me.

Thanks |

2
Dave_L
Re: The date format in MySQL
  • 2003/12/15 19:52

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Those values represent the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

Here's an example of converting to a date/time string:

SELECT FROM_UNIXTIME(post_time) FROM xoops_bb_posts

Thee are other ways of formatting the date/time described here: MySQL Date and Time Functions

Or you could use PHP's functions to do the conversion.

3
marcan
Re: The date format in MySQL
  • 2003/12/15 19:52

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


Thanks a lot !

4
Mithrandir
Re: The date format in MySQL

Yup, the int(10)'s are UNIX timestamps as used in PHP's Date function

Login

Who's Online

293 user(s) are online (240 user(s) are browsing Support Forums)


Members: 0


Guests: 293


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits