Doom87 wrote:Ok.
How could i program it to get the user's relative timezone by their ip?
You could display:
UTC is xxxxxx or Here time is xxxxxx
and:
'Good Morning, Good Day, Good Afternoon, Good Evening, Good Knight
where ever you are!'
Actually, it is by Javascript possible to get a TZ (timezone value)
but I know too little Java to get it automatically into some PHP.
So I have to use a submit button.
You can search http://www.google.com
java Date getTimezoneOffset
Script here below ( test it ), when I click that button, will return this in URL:
http://www.mydomain.com/timezone.php?tz=2
Means I am in timezone UTC+2.
In a php page this value 'tz' can easily be read like this:
timezone.php
<?php
// A script by halojoy
// October 2007
if( isset( $_GET['tz'] ) ) { // if button was clicked
$timezone = $_GET['tz'];
echo 'Thanks! Your time zone is: ' . $timezone;
}else{ // else display form with button
echo 'Please click and submit your TimeZone';
?>
<script type="text/javascript">
function getTzo(){
document.getElementById('tz').value=(new Date().getTimezoneOffset()/60)*(-1);
}
</script>
<form action="">
<input type="hidden" id="tz" name="tz">
<input type="submit" value="Submit My Timezone" onclick="javascript:getTzo();">
</form>
<?php
}
?>