Jump to content

Archived

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

redarrow

explode

Recommended Posts

how do i explode the dates fom dates1 to dates4.


[code]
$dates1
$dates2
$dates3
$dates4

date format is day month year ("d-m-y")

01-06-2006

[/code]

example
[code]
<?

datbase connection

while loop with $row {

dates1=$row["dates1"];
$getdate=explode("$d","-","$m","-","$y",$dates1) {

$a=$d;
$b=$m;
$c=$y;

}
}
ecoho "date is day $a and month is $b and year is $c":
?>
[/code]

Share this post


Link to post
Share on other sites
If I am correct in think that you want to seperate the day, moth and year numbers into sepearte variables?

If thats the case then you'll want to do something like this:
[code]$date1 = "10-05-206";
list($day, $month, $year) = explode("-", $date1);

echo "date is day $a and month is $b and year is $c";[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=372873:date=May 10 2006, 10:46 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ May 10 2006, 10:46 AM) [snapback]372873[/snapback][/div][div class=\'quotemain\'][!--quotec--]
If I am correct in think that you want to seperate the day, moth and year numbers into sepearte variables?

If thats the case then you'll want to do something like this:
[code]$date1 = "10-05-206";
list($day, $month, $year) = explode("-", $date1);

echo "date is day $a and month is $b and year is $c";[/code]
[/quote]

wildteen can you have a quick look at my post please confused mate.

[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=93112\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=93112[/a]

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.