| Bug #7035 | date_format error | ||
|---|---|---|---|
| Submitted: | 6 Dec 2004 11:17 | Modified: | 7 Apr 2006 16:53 |
| Reporter: | Struchkov Vladimir | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 4.1.7, 3.23.58 | OS: | Linux (Linux) |
| Assigned to: | Ramil Kalimullin | CPU Architecture: | Any |
[7 Apr 2006 16:53]
Hartmut Holzgraefe
MySQL::DATE_FORMAT(), unlike PHP::date(), expects a date value, not a unix timestamp. What you are looking for is SELECT DATE_FORMAT(FROM_UNIXTIME(0),'%a, %d %b %Y %T') ; which returns the expected result (for CET): Thu, 01 Jan 1970 01:00:00

Description: I run some simple query select date_format(0,'%a, %d %b %Y %T'); Result: mysql> select date_format(0,'%a, %d %b %Y %T'); +----------------------------------+ | date_format(0,'%a, %d %b %Y %T') | +----------------------------------+ | NULL | +----------------------------------+ 1 row in set (0.00 sec) I write similar php script <?php echo date('r',0)."\n"; ?> I see Thu, 1 Jan 1970 03:00:00 +0300 This value is right How to repeat: always