sm2106 Posted August 21, 2015 Share Posted August 21, 2015 Hi, I have a problem.I have some data stored by WinCC, and I want to read them in PHP. If i do that i get data in UTC time. What Shoud i do to fix it?I'm not good in PHP. Part of code in PHP:$tn[0]="TAG:R,'Agregat_MOC\MOC','".$data_P." 00:00:00.001','".$data_K." 23:59:59.001'.',TIMESTEP=86400,261'";//srednia z dnia OKThis is how it looks like$tn[0]="TAG:R,'Agregat_MOC\MOC','2015-08-01 00:00:00.001','2015-08-31 23:59:59.001'.',TIMESTEP=86400,261'";//srednia z dnia OKThis is how it should looks like$tn[0]="TAG:R,'Agregat_MOC\MOC','2015-07-31 22:00:00.001','2015-08-31 21:59:59.001'.',TIMESTEP=86400,261'";//srednia z dnia OKIm in europe/warsaw timezone (it includes winter/summer time changing) Quote Link to comment Share on other sites More sharing options...
Barand Posted August 21, 2015 Share Posted August 21, 2015 Are you asking how to subtract 1 day from $data_P? Quote Link to comment Share on other sites More sharing options...
sm2106 Posted August 21, 2015 Author Share Posted August 21, 2015 The problem is that I need to have reports from WinCCI have some data stored in WinCC. I want to see some value let say X. I have this value in WinCC database at 2015-07-31 22:00:00.001 and the same value in php at 2015-08-01 00:00:00.001.Probably the problem is that I have UTC time in PHP. But i do not know.Here is the rest of code with "time"Unfortunately in polish $rok = $_POST['rok']; echo $rok; $miesiac = $_POST['miesiac']; echo $miesiac; $_SESSION['rok'] = $rok; $_SESSION['miesiac'] = $miesiac; $data = new datetime($rok.'-'.$miesiac.'-01'); $data_P = $data->format('Y-m-d'); $_SESSION['dzien_p'] = $data_P; $interwal_m = new dateinterval('P1M'); $interwal_d = new dateinterval('P1D'); $data->add($interwal_m); $data_K = $data->format('Y-m-d'); $data->sub($interwal_d); $data_K = $data->format('Y-m-d'); $_SESSION['data_k'] = $data_K; $d_ost = $data->format('d'); $_SESSION['dzien_ost'] = $d_ost; function mkmatrix($rows,$cols){ $count = 1; $mk = array(); for ($i=0;$i<$rows;$i++){ for ($j=0;$j<$cols;$j++){ $mk[$i][$j]=$count++; } } return($mx); } $m1 = mkmatrix(31,52); settype ($sPro, "string"); settype ($sDsn, "string"); settype ($sSer, "string"); $sPro = "Provider=WinCCOLEDBProvider.1;"; $sDsn = "Catalog=CC_ExternalBrowsing;"; $sSer = "Data Source=.\WinCC"; $sCon = $sPro.$sDsn.$sSer; $conn = New COM("ADODB.Connection"); $conn->ConnectionString = $sCon; $conn->CursorLocation = 3; $conn->Open(); $oRs = New COM("ADODB.Recordset"); $oCom = New COM("ADODB.Command"); $oCom->CommandType = 1; $oCom->ActiveConnection = $conn; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.