Get computer time with Coldfusion

I believe this is a simple question but how do I get local time from a user? Isn't there a way to get the computer variable/time for each user that visits our site? Right now I'm getting the server time

<cfset currentDate = dateFormat(now(), "yyyy/mm/dd")>
<cfset currentTime = timeFormat(now(), "h:mm tt")>

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can not get the client's computer time with ColdFusion because CF always runs on the server, not the client's pc. The time variable is determined before the page is even sent to the client.

If you want to get the client's time, then you can use javascript. Which is run on the client's pc.

<script type="text/javascript">
var currentTime = new Date()

and then use javascript functions to get the parts of the date and time that you need. As in:

var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
document.write(month + "/" + day + "/" + year)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
By the way, when you use javascript to get the client's time, that data is only of any value in javascript. It is not like you could use javascript to get the client's time and then somehow send that back to the server to be used in a Cold Fusion function.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.