473,396 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to get a pc time

hi all
i want to get current pc(personal computer) time using php
can anyone suggest me
Sep 13 '07 #1
10 14072
[PHP]
<?php
echo echo date('l dS \of F Y h:i:s A');
?>
[/php]
You can read more about the date function here
http://www.php.net/date
Sep 13 '07 #2
thanks for ur quick reply

here i used like this date('Y-m-d h:i:s A') as well as date('l dS \of F Y h:i:s A')
but both doesn't shows the current pc time
is there anyother way to get pc time??????????
Sep 13 '07 #3
Do you want the users current pc time? If so thats a javascript script question.

http://www.w3schools.com/js/js_obj_date.asp
That link should tell you how to use the date object thats built in.
Sep 13 '07 #4
s,i want users pc time

cant we get this feature in php?????????
Sep 13 '07 #5
hi
here i used like this
$a='<script type="text/javascript"> document.write(Date()) </script>';
echo "$a";
now its working.
but i want to store this variable into mysql database.
In what data type????should i store in database???????
Sep 13 '07 #6
You would need to auto populate a forum with the date object then have it auto submit on page load. Please see the javascript form for additional help on this.
Sep 13 '07 #7
gregerly
192 Expert 100+
hi
here i used like this
$a='<script type="text/javascript"> document.write(Date()) </script>';
echo "$a";
now its working.
but i want to store this variable into mysql database.
In what data type????should i store in database???????
Hi Hemashiki,

You haven't given us much info to go on. You said you wanted to store the users current time in the database, then ask if you should. That all depends on what your application is supposed to do. Are you requirements that your database store the users current time? If so, then yes you should store it. MySQL has a few different date / time datatypes. Check This Out

You could expand the above code by doing this:

[PHP]$a='<script type="text/javascript"> document.write(Date()) </script>';
$sql = "INSERT INTO myTable VALUES ('$a');";
$result=mysql_query($sql);[/PHP]

You wouldn't need to auto populate and form fields or auto submit anything, just handle it all on the server and you'll be good to go.

If this doesn't answer your question, post more info on what your app is supposed to do, and we can probably help you out.

Thanks,

Greg
Sep 14 '07 #8
hey hi....!try printing this ' ".date('y-m-d h:m:s')."' this should give you current system time



Cheers..
Tarun
Sep 19 '07 #9
kovik
1,044 Expert 1GB
hey hi....!try printing this ' ".date('y-m-d h:m:s')."' this should give you current system time
No it won't. We went over that already. This gives the server time, not the user's.


Anyway, there is really no reason to have the user's time. Hell, it's probably the wrong time anyway. :P
You should only need to use your server's time (and make sure your host keeps their server time correct).
Sep 19 '07 #10
Hi hemashiki,

thanks...

$a='<script type="text/javascript"> document.write(Date()) </script>';

Greate..It work like a charm..
Nov 24 '11 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Bart Nessux | last post by:
am I doing this wrong: print (time.time() / 60) / 60 #time.time has been running for many hours if time.time() was (21600/60) then that would equal 360/60 which would be 6, but I'm not getting...
5
by: David Stockwell | last post by:
I'm sure this has been asked before, but I wasn't able to find it. First off I know u can't change a tuple but if I wanted to increment a time tuple by one day what is the standard method to do...
6
by: David Graham | last post by:
Hi I have asked this question in alt.php as the time() function as used in setcookie belongs to php - or does it belong equally in the javascript camp - bit confused about that. Anyway, can anyone...
3
by: Szabolcs Nagy | last post by:
I have to measure the time of a while loop, but with time.clock i always get 0.0s, although python manual sais: "this is the function to use for benchmarking Python or timing algorithms" So i...
6
by: Rebecca Smith | last post by:
Today’s question involves two time text boxes each set to a different time zone. Initially txtCurrentTime will be set to Pacific Time or system time. This will change with system time as we travel...
3
by: luscus | last post by:
Thanks for all the responses on my first question. Unfortunately the answers I was given were too complicated for my small brain , and neophite condition to understand. So if you could talk down to...
3
by: cj | last post by:
If I want to check to see if it's after "11:36 pm" what would I write? I'm sure it's easy but I'm getting tired of having to work with dates and times. Sometimes I just want time or date. And...
1
by: davelist | last post by:
I'm guessing there is an easy way to do this but I keep going around in circles in the documentation. I have a time stamp that looks like this (corresponding to UTC time): start_time =...
2
by: Roseanne | last post by:
We are experiencing very slow response time in our web app. We run IIS 6 - windows 2003. I ran iisstate. Here's what I got. Any ideas?? Opened log file 'F:\iisstate\output\IISState-812.log'...
9
by: Ron Adam | last post by:
I'm having some cross platform issues with timing loops. It seems time.time is better for some computers/platforms and time.clock others, but it's not always clear which, so I came up with the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.