Display PHP clock with user input date and time
The following PHP code displays a clock with current date and time.
I want the clock to receive user input date and time.
How can this be done?
defaulttimezone_set("Asia/Kolkata");
if(@$_GET["action"]=="getTime"){
$time1 = Time();
$date1 = date("m/d/Y h:i:s A",$time1);
//echo $date1; // time output for ajax request
$aa=explode(" ",$date1);
//echo "</br>";
echo "Date: ".$aa[0];
echo "</br>";
echo "Time: " .$aa[1];
die();
}
?>
<div id="qwe"></div>
<script type="text/javascript">
window.onload = startInterval;
function startInterval() {
setInterval("startTime();",1000);
}
function startTime() {
AX = new ajaxObject("?action=getTime", showTime)
AX.update(); // start Ajax Request
}
// CallBack
function showTime( data ){
document.getElementById('qwe').innerHTML = data;
}
</script>
<script type="text/javascript">
// Ajax Object - Constructor
function ajaxObject(url, callbackFunction) {
var that=this;
this.updating = false;
this.abort = function() {
if (that.updating) {
that.updating=false;
that.AJAX.abort();
that.AJAX=null;
}
};
this.update =
function(passData,postMethod) {
if (that.updating) { return false; }
that.AJAX = null;
if (window.XMLHttpRequest) {
that.AJAX=new XMLHttpRequest();
}else{
that.AJAX=new ActiveXObject("Microsoft.XMLHTTP");
}
if (that.AJAX==null) {
return false;
}else{
that.AJAX.onreadystatechange = function() {
if (that.AJAX.readyState==4) {
that.updating=false;
that.callback( that.AJAX.responseText, that.AJAX.status, that.AJAX.responseXML, that.AJAX.getAllResponseHeaders() );
that.AJAX=null;
}
};
//var dt= ;
that.updating = new Date();
if (/post/i.test(postMethod)) {
var uri=urlCall+(/\?/i.test(urlCall)?'&':'?')+'timestamp='+that.updating.getTime();
that.AJAX.open("POST", uri, true);
that.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
that.AJAX.setRequestHeader("Content-Length", passData.length);
that.AJAX.send(passData);
}else{
var uri=urlCall+(/\?/i.test(urlCall)?'&':'?')+passData+'Ã?tamp='+(that.updating.getTime());
that.AJAX.open("GET", uri, true);
that.AJAX.send(null);
}
return true;
}
};
var urlCall = url;
this.callback = callbackFunction || function (){};
}
</script>
View Answers
August 9, 2013 at 7:54 PM
to do so you have to write a small script because php date and time show the server time and date
Related Tutorials/Questions & Answers:
Display PHP clock with user input date and timeDisplay PHP clock with
user input date and time The following
PHP code displays a
clock with current
date and
time.
I want the
clock to receive
user input date and
time.
How can this be done?
<?
php
date<em>
PHP Display date and time()
function in
PHP, it doesn't
display the correct
time and
date for their region...
PHP displaying the
time and
date into your timezone
...
Returns the formatted
date string
Example 1:
<?
php
ECHO "<
Advertisements
escaping user input in phpescaping
user input in php Is it possible to escape the
user input while submitting data into database in
PHP php date input calendarphp date input calendar I'm having an issue while writing the
date input calendar function in
PHP.. any help?
Thanks
How to convert date to time in PHP?How to convert
date to
time in
PHP? Hi, programmer.
The
PHP..., but as a readable
date and
time, it leaves much to be desired. Luckily, the
PHP... google search and found some
PHP Date time scripts listed on the page.
Glad
PHP Date and Time
PHP Date and
Time
The
PHP Date and
Time function is massively used... the functions of the software. ADS_TO_REPLACE_1
The
PHP date and
Time functions allow you to access the
date and
time from the server where your
PHP scripts
PHP Date and Time Functions
The
PHP Date and
Time Functions functions allows the developer to read... to manipulate the
date object in the
PHP code.
Here is the some of the examples of
PHP Date and
Time Functions.ADS_TO_REPLACE_1
Printing amount of seconds
PHP Date and Time The
PHP Date and
Time functions are very useful in manipulating the
Date in your
PHP program. The
PHP Date and
Time generates the current
date and
time... of
PHP date function:
Formatting Option
PHP date functionPHP Date() Function
PHP Date() function is used to
display the
date and
time in a précised
format. With the help of
PHP date function you can format... to
display to format
date and
time in
different style :ADS_TO_REPLACE_1
Syntax
Display Current Date using JSP Custom(user define) TagDisplay Current
Date using JSP Custom(
user define) Tag
In this section, we will discuss about how to
display current
date &
time
using custom(
user...
In this Example, Current
date &
time will
display using custom tag.
Tag
PHP Date and Time Date and time TutorialDate and
time
Learn how to use
PHP Date and
Time functions
To get formatted
date and
time value you can use
date() function. It is
very easy to pass any format you want to get formatted
time output.
string
date(string format, int
Get Date and Time current
date and
time
in the
user given format. To do all this we have first...
Get
Date and
Time
... whose
time fields have been
initialized with the current
date and
time. getTime
How to display the current time. In this web portal i am going to
display time. I am using <%= new java.util.Date() %> to
display the
time. But it
display the
time after that cannot changed...=CYAN>
<TR><TD>
<FORM NAME="
clock_form">
<
INPUT TYPE=TEXT
PHP date_create was introduced in
PHP 5.1.0.
Description
DateTime
date_create ([ string $
time= "now" [, DateTimeZone $timezone= NULL ]] )
Parameters
time...
date_create ()
date_create function returns new DateTime object
PHP DatePHP Date Hi,
How to use
PHP Date functions in my
PHP program?
Thanks
Hi,
PHP Date functions is very handy. It is used to progracess, format and create
date objects in
PHP.
There are many ways to use
PHP Date Mysql Date Input this example we use
PHP tag that include the
input date
'3-Jan-2008' and further...
Mysql
Date Input
Mysql
Date Input is used to give the
input date and convert the
input Date & TimeDate & Time How to insert System
Date &
Time in MS-ACCESS using Java
Date & TimeDate & Time How to insert System
Date &
Time in MS-ACCESS using Java
The PHP Date() Function
The
PHP Date() Function
The
PHP date() function is used for formatting the
date and
time. It formats a timestamp (a sequence of characters representing the
date and/or
time at which a certain event occurred) to make more readable
Time display - JSP-ServletTime display In a web application or ina website if we
display...' system
time. Is
there any difference between getting
time using java
Date class and
JScript
Date class in case of client or server side system
time validate input phpvalidate
input php How to validate the
input fields in
PHP & HTML.
Hi,
Please let's know many fields is to be validated. Then I will make an example for you.ADS_TO_REPLACE_1
Thanks
Display Date - Java BeginnersDisplay Date Plz send me sample java program that
display day,
date,year and crunent
time.
help me plz... Hi friend,
Code to
display day,
date,year and current
time.
import java.util.*;
class DateExample
Date comparison in PHP - PHPDate comparison in PHP I am looking for a
date comparison code in
PHP that can compare the
date in between two different
date formate.. for example:
11/12/1999 and 11/12/2001
to
11.11.1888 00:00:00
any idea on how
Java User InputJava
User Input I am using Scanner class for
user Input.
Scanner s = new Scanner(System.in);
String name = s.next();
but i am unable to store full name in name variable...how i can store full name plsss reply
use
php parse string to timephp parse string to time I am looking for a solution to parse a string into a formatted
date time string
php date function - Date Calendarphp date function Hi,
I am new to
PHP. I am trying to get
date from database. But, every
time the
date under 1970, it changes to 1970. Im...: 1960-12-02 (type is
date )
In
PHP :
$dob= " 1960-12-02
php date format am pmphp date format am pm how to set the
date format that will
display the
date in both am pm format
user input to databaseuser input to database /*
* Studentinfo2App.java
*/
package studentinfo2;
import java.sql.Connection;
import java.sql.DriverManager;
import... in my database
user input from my applet does not show
user input to databaseuser input to database /*
* Studentinfo2App.java
*/
package studentinfo2;
import java.sql.Connection;
import java.sql.DriverManager;
import... in my database
user input from my applet does not show
user input to databaseuser input to database /*
* Studentinfo2App.java
*/
package studentinfo2;
import java.sql.Connection;
import java.sql.DriverManager;
import... in my database
user input from my applet does not show
button to accept user input the radiobutton and spinner.The
user input does not show on my Studentinfo.mdb...button to accept
user input private void jButton1ActionPerformed... that accepts firstname, lastname and gender from
user and insert to database
calculation after if. user input user input????
My apologies
good evening peoples
Once again I am...calculation after if.
user input System.out.print ("please select...[]args){
Scanner
input=new Scanner(System.in);
System.out.print
Only Display DateOnly
Display Date I want to implement only
date not
time like that 20 Sep 2011. How can possiple it?
Your question is not clear. Which technology you use?
java/.NET/SQl
How to read user input in C++How to read
user input in C++ How can i get an
input from the users in C++?
You can use the standard
input "cin" to get the
input from
user..
For example:
int age;
cin >> age
Add Date Time togetherAdd
Date Time together I want to add datetime with
time and result must be datetime. i am unable to do please help me in
php mysql but i need this in javascript. and first datetime is from the text box and another
time is from
javascript current date and time.javascript current
date and
time. How can we
display current
date and
time using javascript?
<html>
<head>
<title>...
with current day,
date,
time and GMT.You can have your own format
user authentication code in php - PHPuser authentication code in php Hi,
Can you please send me a
user authentication code in
php? or just post the guidelines to authenticate a
user.
Thanks