i write code for event calendar in jQuery plugin
when i send data from ajax to php for store event in database
my time is different in JavaScript and php
my time in JavaScript
Tue Jan 02 2018 09:00:00 GMT+0530 (India Standard Time)
when i get this date time in php my time is
2018-01-02T03:30:00.000Z
i have i can get exact date time
which i send from ajax
my ajax code
$.ajax({
type:"POST",
url:"eventCreate.php",
data:{data:enc},
cache: false,
success:function(result){
alert(result);
}
});
data
i have to pass
{start: Tue Jan 02 2018 09:00:00 GMT+0530 (India Standard Time), end: Tue Jan 02 2018 09:30:00 GMT+0530 (India Standard Time), id: 10, date: Tue Jan 02 2018 09:00:00 GMT+0530 (India Standard Time), title: "", …}
body
:
""
date
:
Tue Jan 02 2018 09:00:00 GMT+0530 (India Standard Time) {}
end
:
Tue Jan 02 2018 09:30:00 GMT+0530 (India Standard Time) {}
id
:
10
start
:
Tue Jan 02 2018 09:00:00 GMT+0530 (India Standard Time) {}
title
:
""
__proto__
:
Object
and now how to get exact datetime
in php
my php code
<?php
$con=mysqli_connect("localhost","root","","test");
$data = json_decode($_POST['data']);
$query="insert into event_calendar (`event_id`,`start_time`,`end_time`,`date`,`title`,`body`)
values('".$data->id."','".$data->start."','".$data->end."','".$data->date."','".$data->title."','".$data->body."')";
echo $query;