Jump to content

Archived

This topic is now archived and is closed to further replies.

avo

Get date from mysql date coloum formated correct

Recommended Posts

Hi all

Nice new site!! I LIKE IT !!. ;D

Can anyone please help me out here i have a date coloum in mysql db once ive entered a date in the sql what would be the best way to get this date out and reformated to a uk date DD-MM-YYYY

i was trying this but for some reson it misses the year out when i echo

[quote]<input name="txt_con_expiry" type="text" id="txt_con_expiry" value="<? $tempdate=explode("-", $txt_con_expiry);
echo $tempdate[3];
echo $tempdate[2];
echo $tempdate[1];?>
" />[/quote]
$txt_con_expiry is a variable set when it is SELECTED FROM MY DB
Any ideas please

Share this post


Link to post
Share on other sites
In what way is it stored in db? Timestamp? Other format?

Orio.

Share this post


Link to post
Share on other sites
Hi

When its entered into the db yes im using timestamp formated when it goes in
as

YYYY-MM-DD

Share this post


Link to post
Share on other sites
[code=php:0]//$db_date is the date in db
//$format is after we change the order.
$arr=explode("-",$db_date);
$format=$arr[2]."-".$arr[1]."-".$arr[0];
[/code]
[hr]

This is what you wanted??

Orio.

Share this post


Link to post
Share on other sites
HI Thanks


How did i forget about counts starting at zero not 1

KICKING MYSELF  !!!!


Thanks Help Greatly Appriciated

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.