# Display Current Time - The Eternal Question

**URL:** <https://forum.kirupa.com/t/display-current-time-the-eternal-question/29184>\
**Category:** flash\
**Created:** [August 23, 2003, 4:19pm UTC](https://forum.kirupa.com/t/display-current-time-the-eternal-question/29184 "2003-08-23T16:19:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![artane](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@artane](https://forum.kirupa.com/u/artane)\
**Post date:** [August 23, 2003, 4:19pm UTC](https://forum.kirupa.com/t/display-current-time-the-eternal-question/29184/1 "2003-08-23T16:19:23Z")

</div>

Hi guys,

I’ve got this code that displays the time but, I want the time to display dynamically, updated by the user’s sytem clock so it always displays the “current time”.

myNow=new Date();  
myDay=myNow.getDay();  
myMonth=myNow.getMonth();  
myDate=myNow.getDate();  
myHours=myNow.getHours();  
myMinutes=myNow.getMinutes();  
mySeconds=myNow.getSeconds();  
myYear=myNow.getFullYear();  
theHour=myHours  
noon=""  
if (myHours\>=13){  
theHour=myHours-12;  
}  
else {theHour==myHours;  
}  
if (myMinutes\<10){  
myMinutes=“0”+myMinutes;  
}

if (myHours\<12){  
noon=“am”;  
}  
else {  
noon=“pm”  
}

theDay=new Array(“Sunday”,“Monday”, “Tuesday”, “Wednesday”,“Thursday”, “Friday”, “Saturday”);  
theMonth=new Array(“January”,“February”,“March”,“April”,“May”,“June”,“July”,“August”,“September”,“October”,“November”,“December”);

theDate=theDay[myDay]+"  
“+myDate+” “+theMonth[myMonth]+”, “+myYear+”  
"  
+theHour+":"+myMinutes+" "+noon;

Any help would be greatly appreciated. Thank-You very much!

artane

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 23, 2003, 4:29pm UTC](https://forum.kirupa.com/t/display-current-time-the-eternal-question/29184/2 "2003-08-23T16:29:02Z")

</div>

It does. Read this: [http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary153.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary153.html)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 23, 2003, 4:29pm UTC](https://forum.kirupa.com/t/display-current-time-the-eternal-question/29184/3 "2003-08-23T16:29:25Z")

</div>

when you use the Date object, it will always use the user’s local time if you use getDate, getHour, etc.

It will use the current time from the user’s computer.
