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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.