Jump to content

explode


redarrow

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]
Link to comment
https://forums.phpfreaks.com/topic/9460-explode/
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]
Link to comment
https://forums.phpfreaks.com/topic/9460-explode/#findComment-34870
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]
Link to comment
https://forums.phpfreaks.com/topic/9460-explode/#findComment-34877
Share on other sites

Archived

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

×
×
  • Create New...

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.