Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ติดปัญหา time zone setting ในไฟล์ dashboard.php พอจะมีวิธีแก้ไหมครับ



 

ติดปัญหา time zone setting ในไฟล์ dashboard.php พอจะมีวิธีแก้ไหมครับ

 



Topic : 136401



โพสกระทู้ ( 144 )
บทความ ( 0 )



สถานะออฟไลน์




Code
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in C:\AppServ\www\makrub\modules\dashboard.php on line 4


มีขึ้นเตือนข้อความแบบนี้ในไฟล์ dashboard.php on line 4
พอจะมีวิธีแก้ไหมครับ

Code (PHP)
<?php
  include 'config1.php';
	
	$todayYMD = date("Y-m-d");
	$today = date("d/m/Y");
	$todayQuery = date("d-m-Y");
	$todayTimestamp = strtotime($today);
	$userId = $_SESSION['uid'];
?>

<div class="row">
	<div class="col-lg-5">
		<div class="panel panel-danger">
			<div class="panel-heading">
			  <h3 class="panel-title text-center"><b>Pending Attendance</b></h3>
			</div>
			<div class="panel-body text-center">
				  <?php
					  
					  for($i = 1; $i < 8; $i++) {
						  $dateCurrentYMD = date('Y-m-d', strtotime($todayYMD ." -$i day"));
					  
						  $queryTimeStamp = strtotime($dateCurrentYMD);
						  $dateCurrent = date('d/m/Y', $queryTimeStamp);
										  
						  $query_subjectPending = "SELECT subject.name, subject.id from subject INNER JOIN user_subject WHERE user_subject.id = subject.id AND user_subject.uid = {$_SESSION['uid']}  ORDER BY subject.name";
						  $subPending=$conn->query($query_subjectPending);
						  $rsubPending=$subPending->fetchAll(PDO::FETCH_ASSOC);
						  $today = date("d/m/Y");
						  $todayQuery = date("d-m-Y");
						  $todayDBQuery = strtotime(date("Y-m-d"));
						  $noOfSubjectPending = count($rsubPending);
						  
						  $weekday= strtolower(date("l", strtotime($dateCurrentYMD)));
						  
						  if(($weekday!="saturday") && ($weekday!="sunday")) {
							  for($j = 0; $j<$noOfSubjectPending; $j++) {
								  $subIdP = $rsubPending[$j]['id'];
								  $sqlPending = "SELECT sid, ispresent FROM attendance WHERE id=$subIdP AND date=$queryTimeStamp AND uid=$userId";
								  $stmtP = $conn->prepare($sqlPending); 
								  $stmtP->execute();
								  $resultP = $stmtP->fetchAll(PDO::FETCH_ASSOC); 
								  if(!empty($resultP)){
									  print "<p><a href='index.php?subject=" . $subIdP . "&date=" . $dateCurrentYMD ."' style='text-decoration:none;'>Class: <strong style='color:#555;'>" . $rsubPending[$j]['name'] ."</strong> of <strong>" . $dateCurrent ."</strong></a> <span class='label label-success' style='border-radius:0%;'>Attendance Recorded</span> </p>";
								  }
								  else {
									  print "<p><a href='index.php?subject=" . $subIdP . "&date=" . $dateCurrentYMD ."' style='text-decoration:none;'>Class: <strong style='color:#555;'>" . $rsubPending[$j]['name'] ."</strong> of <strong>" . $dateCurrent ."</strong></a> <span class='label label-danger' style='border-radius:0%;'>Mark Attendance Now!</span></p>";
								  }
							  }
							  
							  if ($i !== 7) {
								  print "<hr>";
							  }
						  }
					  }
						  
				  ?>
				  
			</div>
		  </div>
	</div>

	<div class="col-md-5">
		<div class="panel panel-primary">
			<div class="panel-heading">
			  <h3 class="panel-title text-center"><b>Today's Attendance</b></h3>
			</div>
			<div class="panel-body text-center">
				  <?php
					  
				  
					  $query_subject = "SELECT subject.name, subject.id from subject INNER JOIN user_subject WHERE user_subject.id = subject.id AND user_subject.uid = {$_SESSION['uid']}  ORDER BY subject.name";
					  $sub=$conn->query($query_subject);
					  $rsub=$sub->fetchAll(PDO::FETCH_ASSOC);
					  $today = date("d/m/Y");
					  $todayQuery = date("d-m-Y");
					  $todayDBQuery = strtotime(date("Y-m-d"));
					  $noOfSubject = count($rsub);
					  
					  for($i = 0; $i<$noOfSubject; $i++) {
						  $subId = $rsub[$i]['id'];
						  $sql = "SELECT sid, ispresent FROM attendance WHERE id=$subId AND date=$todayDBQuery AND uid=$userId";
						  $stmt = $conn->prepare($sql); 
						  $stmt->execute();
						  $result = $stmt->fetchAll(PDO::FETCH_ASSOC); 
						  if(!empty($result)){
							  print "<p><a href='index.php?subject=" . $subId . "&date=" . $todayQuery ."' style='text-decoration:none;'>Class: <strong style='color:#555;'>" . $rsub[$i]['name'] ."</strong> of <strong>Today's</strong> (" . $today .")</a> <span class='label label-success' style='border-radius:0%;'>Attendance Recorded</span> </p>";
						  }
						  else {
							  print "<p><a href='index.php?subject=" . $subId . "&date=" . $todayQuery ."' style='text-decoration:none;'>Class: <strong style='color:#555;'>" . $rsub[$i]['name'] ."</strong> of <strong>Today's</strong> (" . $today .")</a> <span class='label label-danger' style='border-radius:0%;'>Mark Attendance Now!</span></p>";
						  }
					  }
				  ?>
			</div>
		  </div>
	</div>

	<div class="col-lg-2">
		<div class="panel panel-success">
			<div class="panel-heading">
			  <h3 class="panel-title text-center"><b>You Have:</b></h3>
			</div>
			<div class="panel-body text-center">
			  <p><i class="fa fa-book"></i> <a href="index.php?page=studentinfo" style='text-decoration:none;'> <strong><span class="badge badge-pill badge-danger"><?php print $noOfSubject; ?></span></strong> Subject/s </a></p>
				  <?php
					  $studentQuery = "SELECT COUNT(DISTINCT sid) as student_count FROM `user_subject` INNER JOIN student_subject WHERE user_subject.id = student_subject.id AND user_subject.uid = $userId";
					  $stmtStudent = $conn->prepare($studentQuery); 
					  $stmtStudent->execute();
					  $resultStudent = $stmtStudent->fetchAll(PDO::FETCH_ASSOC); 
				  ?>
				  
				  <?php if(!empty($resultStudent)) : ?>
					  <p><i class="fa fa-users"></i> <a href="index.php?page=studentinfo" style='text-decoration:none;'><strong><span class="badge badge-pill badge-danger"><?php print $resultStudent[0]['student_count'] ?></span></strong> Student/s</a></p>
				  <?php else: ?>
					  <p><i class="fa fa-users"></i> No Students assigned to you!</p>
				  <?php endif; ?>
			</div>
		  </div>
	</div>
</div>

<div class="row">
	<div class="col-lg-2"></div>

	<div class="col-lg-7">
		
	</div>

	<div class="col-lg-3">
		
	</div>
</div>








Tag : PHP









ประวัติการแก้ไข
2021-09-21 06:08:40
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2021-09-21 06:07:33 By : ajsudkedt View : 612 Reply : 3
 

 

No. 1



โพสกระทู้ ( 1,994 )
บทความ ( 10 )



สถานะออฟไลน์
Facebook Blogger

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Asia/Bangkok"


https://stackoverflow.com/questions/16765158/date-it-is-not-safe-to-rely-on-the-systems-timezone-settings






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-09-21 14:05:24 By : {Cyberman}
 


 

No. 2



โพสกระทู้ ( 1 )
บทความ ( 0 )



สถานะออฟไลน์


ผมใช้วิธีประกาศ

Code (PHP)
date_default_timezone_set("Asia/Bangkok");


ไว้ด้านบนเลยครับ ส่วนมากฝังใน vendor include หลัก
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-09-21 16:54:23 By : oolool444
 

 

No. 3



โพสกระทู้ ( 144 )
บทความ ( 0 )



สถานะออฟไลน์


Code (PHP)
date_default_timezone_set("Asia/Bangkok");


ขอบพระคุณท่าน PHP Fast Coding และท่าน TOP-CS มากครับ
ข้อความที่ฟ้อง หายไปแล้วครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2021-09-21 18:38:40 By : ajsudkedt
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ติดปัญหา time zone setting ในไฟล์ dashboard.php พอจะมีวิธีแก้ไหมครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่