View Full Version : Date Splitting Help!
09-08-2003, 02:38 PM
I have a date that looks like: Sun Aug 17 14:34:39 BST 2003 thats held in a variable named $date.
How can I split it to look like:
Aug 17 2003?
09-08-2003, 04:21 PM
You could explode the variable into an array using a space as the separator, and then recreate a variable with the 2nd, 3rd and 6th parts of the array
$date = "Sun Aug 17 14:34:39 BST 2003";
$date_split = explode (" ", $date);
$new_date = $date_split." ".$date_split." ".$date_split;
possibly not the cleanest way to do it but a quick fix
09-08-2003, 08:02 PM
Cheers - thats exactly what I did, but used the split function instead of explode.
Thanks very much
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.