bug71062.phpt 1008 B

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