Welcome Guest, Not a member yet? Register   Sign In
Need help printing formatted mysql datetime field
#10

[eluser]Zeeshan Rasool[/eluser]
[quote author="Yorick Peterse" date="1241286387"]As stated by others, using a correctly formatted date that's being retrieved from MySQL is better. Probably the best way, or atleast my favourite way, is to store an Unix timestamp as the date in your MySQL table and then use the mdate() function to create a date in a specified format, for example:

Code:
<?php
echo mdate("%d-%m-%Y",$row->date);
?>

In this case $row->date fetches the Unix Timestamp from the MySQL database.[/quote]

Well this is also a good method to get date....


Messages In This Thread
Need help printing formatted mysql datetime field - by El Forum - 04-27-2009, 10:59 PM
Need help printing formatted mysql datetime field - by El Forum - 04-27-2009, 11:03 PM
Need help printing formatted mysql datetime field - by El Forum - 04-27-2009, 11:21 PM
Need help printing formatted mysql datetime field - by El Forum - 04-28-2009, 01:55 AM
Need help printing formatted mysql datetime field - by El Forum - 04-28-2009, 02:24 AM
Need help printing formatted mysql datetime field - by El Forum - 04-28-2009, 04:15 AM
Need help printing formatted mysql datetime field - by El Forum - 05-01-2009, 09:59 AM
Need help printing formatted mysql datetime field - by El Forum - 05-02-2009, 06:36 AM
Need help printing formatted mysql datetime field - by El Forum - 05-02-2009, 06:46 AM
Need help printing formatted mysql datetime field - by El Forum - 05-03-2009, 10:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB