mysql几个有用时间函数

 

1.   select unix_timestamp();

+------------------+

| unix_timestamp() |

+------------------+

|       1288157481 |

+------------------+

 

 

2.  select now();

+---------------------+

| now()               |

+---------------------+

| 2010-10-27 13:31:27 |

+---------------------+

 

3. select unix_timestamp('2010-10-25 14:55:15');

+---------------------------------------+

| unix_timestamp('2010-10-25 14:55:15') |

+---------------------------------------+

|                            1287989715 |

+---------------------------------------+

 

4. select from_unixtime(unix_timestamp());

+---------------------------------+

| from_unixtime(unix_timestamp()) |

+---------------------------------+

| 2010-10-27 13:57:26             |

+---------------------------------+

 

5.select curtime();

+-----------+

| curtime() |

+-----------+

| 13:32:15  |

+-----------+

 

6.select curdate();

+------------+

| curdate()  |

+------------+

| 2010-10-27 |

+------------+

 

7. select from_unixtime('time','%Y-%m-%d') from table where uid = $uid;

你可能感兴趣的:(mysql,unix,table,2010)