i have an android project that Inserts new record to an online mySQL database, it is a free hosting.
hostinger.in
my server in located in India (i think so), and im from Philippines. every time i insert new data, it stores the DATETIME as the server's timezone.
my mySQL data is a DATETIME, default
i would like to insert the DATETIME as my timezone which is Asia/Manila
<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
date_default_timezone_set("Asia/Manila");
$res_accession = $_POST['res_accession'];
$res_usn = $_POST['res_usn'];
$res_author = $_POST['res_author'];
$res_title = $_POST['res_title'];
$res_status = $_POST['res_status'];
$sql = "INSERT INTO res_library (res_accession, res_usn, res_date, res_author, res_title, res_status)
VALUES ('$res_accession', '$res_usn', NOW(),'$res_author', '$res_title', '$res_status')";
require_once('dbConnect.php');
if(mysqli_query($con,$sql)){
echo 'Reservation Successful';
}else{
echo 'Could Not Reserve';
}
mysqli_close($con);
}