Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa PHP Display PHP clock with user input date and time

Have Programming Question? Ask it here!
 
 
 


Manjunath
Display PHP clock with user input date and time
1 Answer(s)      8 months ago
Posted in : PHP


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>

Advertisement
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 time
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? <?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  ... the formatted date string Example 1: <?php ECHO "<b>Date using
Advertisements
escaping user input in php
escaping user input in php  Is it possible to escape the user input while submitting data into database in PHP
php date input calendar
php 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.  The PHP date and Time functions allow you to access the date and time from the server where your PHP scripts are running
Display Date and Time - Design concepts & design patterns
Display Date and Time  HI, Can u send me Html code displaying system date and time . Thanks Prakash  Hi Friend, Try the following code: System Date and Time var date = new Date(); document.write
PHP Date and Time Functions
The PHP Date and Time Functions functions allows the developer to read... of the examples of PHP Date and Time Functions. Printing amount of seconds passed since January 1 1970 00:00:00 GMT: <?php print time(); ?> Printing current date
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
Display Current Date using JSP Custom(user define) Tag
Display Current Date using JSP Custom(user define) Tag In this section, we will discuss about how to display current date & time using  custom(user... & time will display using custom tag. Tag Handler File :  Build
PHP date function
PHP 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 : Syntax : date(format
PHP Date and Time Date and time Tutorial
Date 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
Get Date and Time       In the example given below we will see, how to display current date and time in the user given format. To do all this we have first created instance
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 Displaying the date and time in your timezone Tutorial
PHP Date Time Zone       In PHP Date Time Zone class displays the time of different time zone, along... (if any) of the country. Example: <?php //To instantiate an object $time
Write an Applet which display current date and time on the web page??
Write an Applet which display current date and time on the web page??  Write an Applet which display current date and time on the web page??  Here is an applet code that display date and time. import java.applet.
Write an Applet which display current date and time on the web page??
Write an Applet which display current date and time on the web page??  Write an Applet which display current date and time on the web page?  Here is an applet code that display date and time. import java.applet.
How to display mysql database records as per clock timing?
How to display mysql database records as per clock timing?  I want to display database records as per clock timing
Date & Time
Date & Time  How to insert System Date & Time in MS-ACCESS using Java
Date & Time
Date & Time  How to insert System Date & Time in MS-ACCESS using Java
Java User Input
Java 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
Mysql Date Input
PHP tag that include the input date '3-Jan-2008' and further convert the input... Mysql Date Input       Mysql Date Input is used to give the input date and convert the input
user input to database
user 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 database
user 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 database
user 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
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
Time display - JSP-Servlet
Time 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
PHP Date
PHP 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
validate input php
validate 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. Thanks
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
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
store input and display previous input as well current input. in jsp
store input and display previous input as well current input. in jsp  Hi Friend, In this JSP program i want display the previous input as well current inputs also. currently only current input i am able to display whenever i
Display Date - Java Beginners
Display 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
java user input - Java Beginners
java user input  how to input from keyboard? please give a example.  Hi Friend, There are lot of ways to input data from keyboard.You...:****** try{ System.out.print("Enter String:"); BufferedReader input = new
user input in java - Java Beginners
user input in java   i am trying to write a code to compute the average of 5 numbers but i dont know what to do for the program to accept user input  Hi import java.util.*; public class AverageExample { public
php parse string to time
php parse string to time  I am looking for a solution to parse a string into a formatted date time string
error in taking input from user.
error in taking input from user.  //i m having problem inputting the array from user.my program is import java.io.*; class bubble { public static void main(String args[]) { int a[]=new int[20]; int i=0; BufferedReader br=new
convert date time to int
convert date time to int  convert date time to int
How Insert DateTime Vales into Mysql Databse from the front end application.But User Gives Date only from Datepicker,not Time
User Gives Date only from Datepicker,not Time  I am new developer in .net,I Have requirement..like this ,when user pick date from date picker not time only date he/she pick up,then click insert that time ,i want insert that date
How Insert DateTime Vales into Mysql Databse from the front end application.But User Gives Date only from Datepicker,not Time
User Gives Date only from Datepicker,not Time  I am new developer in .net,I Have requirement..like this ,when user pick date from date picker not time only date he/she pick up,then click insert that time ,i want insert that date
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
Add Date Time together
Add 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
user defined date class
user defined date class  Develop a user defined date class with public.Fill the members using existing class method.implement the methods for finding current date(),days between method,advanced days and after days
user defined date class
user defined date class  Develop a user defined date class with public.Fill the members using existing class method.implement the methods for finding current date(),days between method,advanced days and after days
Java get User Input
Java get User Input       In this section, you will learn how to get the user input from... that will communicate with the user at the command line and returns the user input. We have
Date comparison in PHP - PHP
Date 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
Only Display Date
Only 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
php date function - Date Calendar
php 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
 

 

 

DMCA.com