1 00:00:00,630 --> 00:00:01,790 Hello and welcome. 2 00:00:01,810 --> 00:00:03,270 In this fit you. 3 00:00:03,450 --> 00:00:10,650 I'm going to add some javascript code that will enable the clock to display. 4 00:00:10,710 --> 00:00:14,850 So inside my text had it all here. 5 00:00:15,060 --> 00:00:22,200 Just want to make sure I've got my hastier Mail see if we click on the hastier much fun now you would 6 00:00:22,200 --> 00:00:27,250 not see anything to find double-click and just click on the file. 7 00:00:27,420 --> 00:00:36,350 You can see just got a blank space so nothing will get displayed on till the javascript has been written. 8 00:00:36,360 --> 00:00:45,300 Some just can open up the javascript file so click on this my script jirus and I will just collapse 9 00:00:45,330 --> 00:00:54,430 this index started to email to that have some space and also drag this in a bit to create more space. 10 00:00:54,540 --> 00:01:07,050 So the first and I want to do is had a function and method the method I'm going to add it's called the 11 00:01:07,050 --> 00:01:10,310 set interval method. 12 00:01:10,740 --> 00:01:23,340 So I had read a method called set interval and also added a function set interval method is used to 13 00:01:23,370 --> 00:01:32,320 call a function that value it's an expression at a specified interval. 14 00:01:32,320 --> 00:01:38,970 The interval is usually set in many seconds to what they set interval to. 15 00:01:38,970 --> 00:01:41,040 It all continue to run. 16 00:01:41,040 --> 00:01:50,880 This is what will make the clock continue to tick a thousand milliseconds is equivalent to 1 second 17 00:01:51,930 --> 00:01:53,300 set interval. 18 00:01:53,340 --> 00:01:59,310 Third require as the function that will be executed. 19 00:01:59,580 --> 00:02:07,630 Okay so in between this curly braces here I am going to add some code that to enable the clock to be 20 00:02:07,690 --> 00:02:12,080 displayed and then said I want to do inside this function. 21 00:02:12,080 --> 00:02:27,570 Here is create a new variable and set that variable to quote to a new date object Date object is a data 22 00:02:27,570 --> 00:02:37,050 type that is built into the javascript object on language so to create a new date object you use the 23 00:02:37,050 --> 00:02:41,830 new date command to create an object. 24 00:02:41,840 --> 00:02:44,650 So let me add the code so you can see. 25 00:02:44,820 --> 00:02:53,420 So I've created a variable here called current time and I said that to a new date object and then extend 26 00:02:53,430 --> 00:03:02,920 I want to do is quote some variables that will store me hours minutes and seconds. 27 00:03:03,240 --> 00:03:09,360 So I've now added the three variables created a variable called hours minutes and seconds. 28 00:03:09,360 --> 00:03:18,690 I've said that to you course to this current time variable and Tash get hours method to get hours metabolically 29 00:03:18,690 --> 00:03:18,980 warm. 30 00:03:19,000 --> 00:03:26,370 Get the hours that is returned they get minutes metod will returned in minutes that's returned and they 31 00:03:26,380 --> 00:03:30,970 get seconds method will return the seconds returned. 32 00:03:30,990 --> 00:03:40,370 Also I want to be able to specify based on the time if it's P. M. or M saw to do that. 33 00:03:40,380 --> 00:03:44,930 I need to create a variable that will store the value. 34 00:03:44,940 --> 00:03:54,950 So I'm going to create on another variable that will store a value for him sough quoted a variable quod 35 00:03:54,990 --> 00:04:01,990 period and I've set that to a value of a m. 36 00:04:02,200 --> 00:04:10,860 The next thing I want to do I want to use a conditional statement in order to determine if it's in or 37 00:04:11,040 --> 00:04:12,760 P. M.. 38 00:04:13,020 --> 00:04:14,670 So this is a condition here. 39 00:04:14,670 --> 00:04:20,770 I have added some checking for some condition the same if the hours variable. 40 00:04:20,770 --> 00:04:27,790 This hours here is great and down or equal to 12. 41 00:04:28,020 --> 00:04:34,590 Then this variable here will be regarded as P. M.. 42 00:04:34,590 --> 00:04:38,980 I added some more conditions here so from here to here. 43 00:04:39,160 --> 00:04:47,700 So here on line 11 saying if the hours variable hours here is less than 12 I'm setting the hours to 44 00:04:47,730 --> 00:04:51,150 equal to the hours minus 12. 45 00:04:51,150 --> 00:04:59,580 Here again chaykin give the seconds variable is less than 10 AM set in the second clearable to eat. 46 00:04:59,730 --> 00:05:03,230 Was 2 0 plus the seconds. 47 00:05:03,720 --> 00:05:04,750 This one also. 48 00:05:04,770 --> 00:05:12,850 I'm checking the minutes variable variable here is less than 10 AM set in the minutes variable took 49 00:05:12,850 --> 00:05:14,400 of course to zero. 50 00:05:14,400 --> 00:05:16,680 Plus the minutes. 51 00:05:16,690 --> 00:05:24,780 Next since I want to do now is create a variable that will store all these values in order to display 52 00:05:24,930 --> 00:05:25,870 the clock. 53 00:05:26,340 --> 00:05:33,720 So I've created a variable here on line 20 chord clock time and I've set that to your Kwas to the hours 54 00:05:33,720 --> 00:05:36,390 variable which is this variable here. 55 00:05:36,600 --> 00:05:45,030 Plus this here's just great innerspace Plus the minutes variable Plus the second variable Plus the peer 56 00:05:45,030 --> 00:05:45,450 to peer a. 57 00:05:45,450 --> 00:05:48,940 Basically it would tell you if it's an M or p. m.. 58 00:05:48,930 --> 00:05:56,790 Based on these conditions this could see a bizarrely used to create spaces between the hours the minutes 59 00:05:56,850 --> 00:06:00,920 seconds and the period period represents the variable here. 60 00:06:01,050 --> 00:06:08,820 So depending on this condition it will determine if it's m or P. M. The next someone to do is quit a 61 00:06:08,820 --> 00:06:12,240 variable that will display the clock. 62 00:06:12,510 --> 00:06:17,160 So here I caught an idea here chord clock. 63 00:06:17,220 --> 00:06:22,870 So this is where I want to call the clock to be displayed inside this variable. 64 00:06:22,890 --> 00:06:32,460 Inside this I see chord clock which is a div so I need to create a variable that will achieve that. 65 00:06:32,610 --> 00:06:41,290 So I have now created a variable on line 21 called clock an offset that took it was to document. 66 00:06:41,300 --> 00:06:49,660 Don't get telamon by Dean method this method here will return the I.D. element which is specified here. 67 00:06:49,950 --> 00:06:51,420 And this clock idea. 68 00:06:51,420 --> 00:06:54,950 Here is the irony of this db here. 69 00:06:54,990 --> 00:06:57,360 That's what I am targeting too. 70 00:06:57,480 --> 00:07:03,750 Will return that does what this says and here reference seem. 71 00:07:03,910 --> 00:07:06,140 This variable here. 72 00:07:06,270 --> 00:07:19,710 Chord clock and I am changing in a text to the value of the clock time to the variable here and well 73 00:07:19,710 --> 00:07:26,230 a variable we call clock time we should display B hours the minutes the seconds and the periodicities 74 00:07:26,300 --> 00:07:27,810 a.m. or p.m.. 75 00:07:27,990 --> 00:07:29,880 So thats what Im doing here. 76 00:07:29,880 --> 00:07:37,960 I am changing the inner text of this idea here called clock change in a use in this property. 77 00:07:38,100 --> 00:07:44,790 In a text to this variable so this will make it display a clock. 78 00:07:45,110 --> 00:07:51,160 Basically this will reference all these values from your current computer. 79 00:07:51,210 --> 00:07:57,750 So whatever clock your computer is showing that square is going to pick up the time from here you got 80 00:07:57,840 --> 00:07:58,860 a time right here. 81 00:07:58,860 --> 00:08:02,010 This is only time in milliseconds. 82 00:08:02,010 --> 00:08:09,930 This set in tabar function also runs every time this milliseconds enables the clock tick. 83 00:08:10,110 --> 00:08:15,090 So that means the clock will be ticking every one second. 84 00:08:15,090 --> 00:08:16,950 That's what this one puzzle for is. 85 00:08:16,950 --> 00:08:24,470 It means the clock would take every millisecond which is equivalent to one second. 86 00:08:24,660 --> 00:08:29,140 So if I save that now we should see some activity. 87 00:08:29,160 --> 00:08:31,510 MBA browser. 88 00:08:31,760 --> 00:08:39,600 All right so this is it you can see is showing me my current time and it tells you it is actually p. 89 00:08:39,600 --> 00:08:39,830 m.. 90 00:08:39,840 --> 00:08:40,980 At the moment. 91 00:08:41,040 --> 00:08:48,890 So in the nakes feeding one as some see access to make this look much more pronounced and presentable. 92 00:08:49,080 --> 00:08:51,930 Thanks very much for watching and by phone now.