Guest User

Untitled

a guest
Feb 10th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. [arrayItem] => DateTime Object
  2. (
  3. [date] => 2008-06-05 09:14:11
  4. [timezone_type] => 3
  5. [timezone] => Europe/London
  6. )
  7.  
  8. $connectionParams = array(
  9. 'USR'=>'user',
  10. 'PASS'=>'pass',
  11. 'Database'='myDatabase',
  12. 'ReturnDatesAsStrings'=>true //<-- This is the important line
  13. );
  14. $conn = sqlsrv_connect('127.0.0.1',$connectionParams);
  15.  
  16. $myDateTimeObject->getTimestamp();
  17.  
  18. $array['arrayItem']->date;
  19. $array['arrayItem']->timezone_type;
  20.  
  21. echo $array['arrayItem']->format('Y-m-d H:i:s');
  22.  
  23. $_date = DateTime::createFromFormat('D M d Y H:i:s e+', $the_date);
  24. foreach($_dateStart as $row){
  25. echo $row; // returns 2014-06-04 15:00
  26. break; // stops at the first position
  27. }
  28.  
  29. $array['arrayItem']->format('Y-m-d H:i:s');
  30.  
  31. $serverName = "your_sqlserver";
  32. $username = "your_username";
  33. $password = "your_password";
  34. $database = "your_database";
  35. $connectionInfo = array( "UID"=>$username, "PWD"=>$password, "Database"=>$database, "ReturnDatesAsStrings"=>true);
  36. $connection = sqlsrv_connect($serverName, $connectionInfo);
  37.  
  38. $result = sqlsrv_query( $connection,"SELECT * from table'");
  39. $msrow = sqlsrv_fetch_array($result);
  40.  
  41. $obj->arrayItem->format('H:i:s')
  42.  
  43.  
  44. $obj->arrayItem->format('Y-m-d')
  45.  
  46. date('Y-m-d', strtotime($rs->Fields('time')->value)
Add Comment
Please, Sign In to add comment