Date formatting/flexibility?

R

Rob Cole

Guest
I'm trying to figure out how to do two things, if possible - one, I'd like to have the "date" field displayed in the less conventional American date style (as per request of one of my users), MM/DD/YYYY. Is this possible? In addition, they want to see if we can start the year at 2002 in these entries...

thanks,
Rob
 
E

Eugenio

Guest
Rob Cole wrote:
>
> I'm trying to figure out how to do two things, if possible -
> one, I'd like to have the "date" field displayed in the less
> conventional American date style (as per request of one of my
> users), MM/DD/YYYY. Is this possible?

File general_functions.php, change the function format_date($date).

> In addition, they
> want to see if we can start the year at 2002 in these
> entries...

Look at config.php

(Latest version of DaDaBIK when this message was posted: 1.6)
 
R

Rob Cole

Guest
Ok - here is the code for format_date($date)..

function format_date($date)
// from "2000-12-15" to "15 Dec 2000"
{
$temp=explode("-",$date);
$date=date("j M Y",mktime(0,0,0,$temp[1],$temp[2],$temp[0]));
return $date;
}

I'm a bit new to PHP, but was trying to figure out how to recode this for MM/DD/YYYY. I can't get it working...tried:

function format_date($date)
// from "2000-12-15" to "15 Dec 2000"
{
$temp=explode("-",$date);
$date=date("M j Y",mktime(0,0,0,$temp[2],$temp[1],$temp[0]));
return $date;
}

I also tried...

function format_date($date)
// from "2000-12-15" to "15 Dec 2000"
{
$temp=explode("-",$date);
$date=date("M j Y",mktime(0,0,0,$temp[1],$temp[2],$temp[0]));
return $date;
}

I know I'm missing something simple. Help?

thanks,
Rob
 
B

bob

Guest
This will give you MM/DD/YYYY ( 02/21/2002 )

$date=date("m/d/Y",mktime(0,0,0,$temp[2],$temp[1],$temp[0]));
 
R

Rob Cole

Guest
Sorry. I was being a bit thick-headed.

Here is what I was looking for (and found, after I had my coffee).

$date_select =
"<table><tr><td>$day_select</td><td>$month_select</td><td>$year_select</td></tr></table>";

:)

thanks,
Rob
 
Top