-1

My web app is currently hosted somewhere in Great Britain and i have 2 hour difference with it but i need to use the time that is used by the server. So i use time() * 1000 and create from this timestamp new date object like time_data.minDate = new Date(<?php echo $test_time['start'];?>);, but i still receive +2h.

Full example:

time_data.minDate = new Date(<?php echo $test_time['start'];?>);
time_data.maxDate = new Date(<?php echo $test_time['end']['min'];?>);

console.log(time_data.minDate);
console.log('<?php echo date('Y-m-d H:i:s', $test_time['start'] / 1000)?>');
console.log(time_data.maxDate);
console.log('<?php echo date('Y-m-d H:i:s', $test_time['end']['min'] / 1000)?>');

enter image description here

So is it possible somehow to force to use the date from timestamp?

Kin
  • 4,466
  • 13
  • 54
  • 106

1 Answers1

-1

Set different time zone for your PHP server:

date_default_timezone_set ('Europe / Rome');

More information: http://php.net/manual/en/function.date-default-timezone-set.php

  • i dont need to set it. I just need to create the date from timestamp as it is. – Kin Nov 07 '13 at 09:26
  • OK for create the date from timestamp use this function [strftime()](http://php.net/manual/en/function.strftime.php) – Petar Kolev Nov 07 '13 at 09:31
  • i think you didn't understand my question: the main problem is that js adds timezone to the date and i don't need it. Everything else is fine. – Kin Nov 07 '13 at 09:34