[PHP] Re: newbie date time question

2011-06-22 Thread David Nicholls
On 23/06/11 10:04 AM, Shawn McKenzie wrote: On 06/22/2011 06:54 PM, David Nicholls wrote: I'm late to the party, but strtotime works great, though you need to give it what it expects: $ts = strtotime(str_replace('/', '-', $date)); Thanks, Shawn, that's a bit mo

Re: [PHP] newbie date time question

2011-06-22 Thread David Nicholls
On 23/06/11 1:02 AM, Stuart Dallas wrote: On Wednesday, 22 June 2011 at 15:59, David Nicholls wrote: OK, looks like I have fixed problem, using: $format = 'd/m/Y g:i:s A'; $dt = date_create_from_format($format, $d[0]); $dt2 = date('r', $dt->getTimestamp()); $d

[PHP] Re: newbie date time question

2011-06-22 Thread David Nicholls
On 23/06/11 1:35 AM, Shawn McKenzie wrote: On 06/22/2011 09:05 AM, David Nicholls wrote: I'm trying to convert a date and time string using strtotime() The date and time strings are the first entry in each line in a csv file in the form: 22/06/2011 9:47:20 PM, data1, data2,... I&#x

Re: [PHP] newbie date time question

2011-06-22 Thread David Nicholls
/en/datetime.format.php) method on your $dt object. On Wed, Jun 22, 2011 at 4:41 PM, David Nicholls wrote: On 23/06/11 12:23 AM, Adam Balogh wrote: hi, you have a PM(/AM) in your date ($d[0]), so put an "A" (Uppercase Ante meridiem and Post meridiem) format char to your $format variable.

Re: [PHP] newbie date time question

2011-06-22 Thread David Nicholls
On 23/06/11 12:30 AM, Richard Quadling wrote: On 22 June 2011 15:05, David Nicholls wrote: I'm trying to convert a date and time string using strtotime() The date and time strings are the first entry in each line in a csv file in the form: 22/06/2011 9:47:20 PM, data1, data2,... I&#x

Re: [PHP] newbie date time question

2011-06-22 Thread David Nicholls
On 23/06/11 12:23 AM, Adam Balogh wrote: hi, you have a PM(/AM) in your date ($d[0]), so put an "A" (Uppercase Ante meridiem and Post meridiem) format char to your $format variable. b3ha Thanks, Adam. Tried that and it's now throwing an error: Catchable fatal error: Object of class DateTime

[PHP] newbie date time question

2011-06-22 Thread David Nicholls
I'm trying to convert a date and time string using strtotime() The date and time strings are the first entry in each line in a csv file in the form: 22/06/2011 9:47:20 PM, data1, data2,... I've been trying to use the following approach, without success: function read_data($filename) { $f