Jump to content

Timezone Detection


DeanWhitehouse

Recommended Posts

Have them mark their local time zone and DST settings on an options page, or put their local time in a hidden input that you make with Javascript. =P  There's a way to do anything that you need done. *

 

*Some conditions apply.  See official rules for details.

Link to comment
https://forums.phpfreaks.com/topic/102205-timezone-detection/#findComment-523245
Share on other sites

well this is the page where the date is inserted.

<?php
require_once 'db_connect.php';
require_once 'config_table.inc.php';

// get data that sent from form
$topic=$_POST['topic'];
$detail=$_POST['detail'];
$name=$_POST['name'];
$email=$_POST['email'];

$datetime=date("jS of M Y h:ia e"); //create date time

$sql="INSERT INTO $forum_quest(topic, detail, name, email, datetime)VALUES('$topic', '$detail', '$name', '$email', '$datetime')";
$result=mysql_query($sql);

if($result){
echo "Successful<BR>";
echo "<a href=main_forum.php>View your topic</a>";
}
else {
echo "ERROR";
}
mysql_close();
?>

 

could i change it to this

<?php
require_once 'db_connect.php';
require_once 'config_table.inc.php';

// get data that sent from form
$topic=$_POST['topic'];
$detail=$_POST['detail'];
$name=$_POST['name'];
$email=$_POST['email'];

$datetime=?><html><script type="text/javascript">

var d = new Date();
document.write(d.getHours());
document.write(".");
document.write(d.getMinutes());
document.write(".");
document.write(d.getSeconds());

</script> </html>//create date time
<?php
$sql="INSERT INTO $forum_quest(topic, detail, name, email, datetime)VALUES('$topic', '$detail', '$name', '$email', '$datetime')";
$result=mysql_query($sql);

if($result){
echo "Successful<BR>";
echo "<a href=main_forum.php>View your topic</a>";
}
else {
echo "ERROR";
}
mysql_close();
?>

Link to comment
https://forums.phpfreaks.com/topic/102205-timezone-detection/#findComment-523251
Share on other sites

how would i do that?

<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form id="form1" name="form1" method="post" action="add_topic.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3" bgcolor="#E6E6E6"><strong>Create New Topic</strong> </td>
</tr>
<tr>
<td width="14%"><strong>Topic</strong></td>
<td width="2%">:</td>
<td width="84%"><input name="topic" type="text" id="topic" size="50" /></td>
</tr>
<tr>
<td valign="top"><strong>Detail</strong></td>
<td valign="top">:</td>
<td><textarea name="detail" cols="50" rows="3" id="detail"></textarea></td>
</tr>
<tr>
<td><strong>Name</strong></td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50" /></td>
</tr>
<tr>
<td><strong>Email</strong></td>
<td>:</td>
<td><input name="email" type="text" id="email" size="50" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></td>
</tr>
</table>
</td>
</form>
</tr>
</table>

the form that is sent.

i don't want to show them the time when it is sent

Link to comment
https://forums.phpfreaks.com/topic/102205-timezone-detection/#findComment-523263
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.