From:             ecit12 at hotmail dot com
Operating system: Fedore Core 2
PHP version:      4.3.8
PHP Bug Type:     Date/time related
Bug description:  Converting Normal time to Unix time

Description:
------------
Basically, I wanted to take a normal time stamp that is in the form of

YYYYMMDDHHMMSS and convert it to Unix format using the Date function.

The last $myDate variable should match the initial date, but it doesn't
work.

It would be nice if PHP had more support for normal date formats instead
of forcing ppl to convert to unix time. 

Reproduce code:
---------------
$myDate = 20041110113800 // 2004, Nov 10, 11:38:00
echo "The date in normal form: $myDate";
echo "<BR>";
$myDate = date("U",$myDate);
echo "The date in Unix format: $myDate";
echo "<BR>";
// added 00 for seconds since PHP has nothing for seconds
$myDate = date("YmdHi",$myDate)."00"; 
echo "The date in Normal format again: $myDate";

Expected result:
----------------
The date in normal form: 20041110113800
The date in Unix format: 1100086680
The date in Normal format again: 20041110113800

Actual result:
--------------
The date in normal form: 20041110113800
The date in Unix format: 792710664
The date in Normal format again: 19950213132400

-- 
Edit bug report at http://bugs.php.net/?id=30753&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30753&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=30753&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=30753&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30753&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30753&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30753&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30753&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30753&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30753&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30753&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=30753&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=30753&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30753&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30753&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30753&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30753&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30753&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30753&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30753&r=mysqlcfg

Reply via email to