Get Local time| Get International Time in Javascript | Get Local time in php | Get Time according to timezone in php | Get Time According to local timezone

Local Time/ International Time.
Headache!

The solution:-

Use unix timestamp for converting time to local of international timezone for different places.

Just save your time as unix timestamp.

From Your Browser: with javascript
const unixtime= new Date().getTime();

Save this timestamp for database.
While printing on frontend just pass it into the Date class:
const localTime= new Date(unixtime);




From php script:

$unixTime=time().'000';



Comments

Popular posts from this blog

aaabb to32 ,aabbb to a2b3 convert in c-asr

a2b3 output aabbb c program and beautiful use of getchar() ,isdigit() ,atoi() functions and stdlib.h header file-asr

C program to print square spiral number pattern - asr