javascript - How to get server time not localtime in php -


first part of question :

when m using new date (); in javascript.

it gives

fri jun 19 2015 11:18:02 gmt+0530 (india standard time) 

this giving local machine time.whereas server time 7 mins ahead.

is there function gives server time not local machine time same new date() server not localmachine.

in project using codeigniter.is there method keep datetime same servertime not localmachine time.

so when use echo date('y-m-d h:i:s'). gives server time.

second part of question :

how echo date in php in same format new date() in javascript:

new date() prints fri jun 19 2015 11:18:02 gmt+0530 (india standard time)

but in php date('d m y g:i:s t', time()); giving fri jun 19 2015 11:18:02 ist

how achieve same format new date().

if work on real server believe can proper time snippet.

function server_time() {   $this->load->helper('date');   echo now();     echo "<br>"; } 

if use xampp or wamp on local pc time you'll local pc time.


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -