I have a very large txt file javascript array - too big for me to go and edit each entry separately. It looks like this:
["12/1/2011 00:00",15848],["12/1/2011 01:00",15108],["12/1/2011 02:00",14643],["12/1/2011 03:00",14265], &c.
How can I pass this file through PHP to change all the dates and write a new file? I'm thinking I need to use strptime()
or strtotime()
but I'm not sure how to proceed.
The date format is Month/Day/Year
.
EDIT: I ended up recreating the array from a CSV file. Here's the code I used in case anyone's interested. Thanks for the help.
$handle = fopen("stuff.csv", "r");
while(($data = fgetcsv($handle, ",")) !== FALSE) {
echo "[" . strtotime($data[0]) . ", " . $data[1] . "],<br />";
}