1--TEST-- 2Bug #71062 pg_convert() doesn't accept ISO 8601 for datatype timestamp 3--EXTENSIONS-- 4pgsql 5--SKIPIF-- 6<?php include("skipif.inc"); ?> 7--FILE-- 8<?php 9 10include('config.inc'); 11 12$db = pg_connect($conn_str); 13 14$table = "public.test_table_bug71062_bug71062"; 15 16pg_query($db, "CREATE TABLE $table ( test_field TIMESTAMPTZ )"); 17 18// ISO 8601 (with 'T' between date and time) 19$date_string_php_iso8601 = date_create('8 Dec 2015 5:38')->format(DateTime::ISO8601); 20 21// ISO 8601 with the 'T' removed 22$modified_format = 'Y-m-d H:i:sO'; 23$date_string_modified_iso8601 = date_create('8 Dec 2015 5:38')->format($modified_format); 24 25printf("trying format %s \n", DateTime::ISO8601); 26pg_convert($db, $table, ['test_field' => $date_string_php_iso8601]); 27 28printf("trying format %s \n", $modified_format); 29pg_convert($db, $table, ['test_field' => $date_string_modified_iso8601]); 30 31print "done\n"; 32 33pg_query($db, "DROP TABLE $table"); 34 35?> 36==OK== 37--EXPECT-- 38trying format Y-m-d\TH:i:sO 39trying format Y-m-d H:i:sO 40done 41==OK== 42