View previous topic :: View next topic |
Author |
Message |
olly86 -
Joined: 25 Apr 2003 Posts: 993 Location: Wiltshire, UK
|
Posted: Mon Apr 04, 2005 9:06 pm Post subject: PHP date & mktime function problem |
|
|
The following code creates the right date:
Code: | $date = date("l jS F Y", mktime(0,0,0,4,3,2005)); |
However, if I use the same "0,0,0,4,3,2005" extracted from a database as "$row['Updated']" it shows today's date.
Code: | $date = date("l jS F Y", mktime($row['Updated'])); |
Does anyone know why this happens?
---
php date function explained.
NOTE: the date is in the "wrong" (American) format, as that is how the function "mktime" requires it.
The date should be displayed as Sunday 3rd April 2005 _________________ Olly |
|
Back to top |
|
|
Glitch2082 -
Joined: 02 Dec 2004 Posts: 194
|
Posted: Mon Apr 04, 2005 11:01 pm Post subject: |
|
|
Code: | $date = date("l jS F Y", mktime(" . $row['Updated'] . ")); |
_________________ int main() {
cout << "Im Pro Apache";
cin.get();
} |
|
Back to top |
|
|
olly86 -
Joined: 25 Apr 2003 Posts: 993 Location: Wiltshire, UK
|
Posted: Mon Apr 04, 2005 11:07 pm Post subject: |
|
|
thanks, but that's not it. I now get the following error:
Quote: | Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in E:\Servers\Abyss Web Server\htdocs\Game\info.php on line 27 |
Line 27 is where that code is located _________________ Olly |
|
Back to top |
|
|
Glitch2082 -
Joined: 02 Dec 2004 Posts: 194
|
Posted: Tue Apr 05, 2005 12:54 am Post subject: |
|
|
Oops, I didn't see, it wasn't quoted, sorry :P
Quote: | $date = date("l jS F Y", mktime($row['Updated'])); |
That should work... dunno why it didn't. _________________ int main() {
cout << "Im Pro Apache";
cin.get();
} |
|
Back to top |
|
|
olly86 -
Joined: 25 Apr 2003 Posts: 993 Location: Wiltshire, UK
|
Posted: Tue Apr 05, 2005 12:45 pm Post subject: |
|
|
thanks, that's worked a treat. _________________ Olly |
|
Back to top |
|
|
|