Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Premium Land with House for Sale
anil1961
Updated:
Friday at 10:15 AM
AWS Certified Solutions Architect-Associate + AWS Certified Cloud Practitioner
Sanjeewani95
Updated:
Wednesday at 8:16 PM
🚀 එක පැකේජ් එකයි - මාසෙටම Unlimited Internet! 🌐
sayuru bandara
Updated:
Tuesday at 10:57 AM
🎬 CapCut Pro 1 Month Access! LKR 600
sayuru bandara
Updated:
Tuesday at 10:55 AM
🚀 Google One AI PRO Plan (Gemini Pro Activation) – 18 Months Access! LKR 2200
sayuru bandara
Updated:
Tuesday at 10:53 AM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
JAVASCRIPT HELP !!!!!!!!!!!
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="වින්ඩොස් 8" data-source="post: 13853280" data-attributes="member: 439987"><p>Program 3: </p><p>Get today's date using the Date class. Print the date, month, and year. If the day is a weekday, print "uh..oh...it is a weekday". If the day is either Saturday or Sunday, print "Great...It is the weekend". </p><p>Use the following methods:</p><p>getFullYear ( ) - Retrieves the year component of the date as a 4-digit number.</p><p>getMonth ( ) - Retrieves the month component of the date as a number from 0 to 11 (0=January, 1=February, etc)</p><p>getDate ( ) - Retrieves the day-of-month component of the date as a number from 1 to 31</p><p>getDay ( ) - Retrieves the day of the week component of the date as a number from 0 to 6 (0=Sunday, 1=Monday, etc)</p><p>Sample code:</p><p>The following code prints today's date and month.</p><p><html></p><p><head></p><p><title>Write the Date</title></p><p><script language="JavaScript"></p><p><!-- hide me</p><p></p><p>// get the date information</p><p>//</p><p>var today = new Date();</p><p>var the_day = today.getDate();</p><p>var the_month = today.getMonth();</p><p></p><p>// correct for the month starting from zero</p><p>//</p><p>the_month = the_month + 1;</p><p></p><p>// create the string you want to print</p><p>//</p><p>var the_whole_date = the_month + "/" + the_day;</p><p></p><p>// show me --></p><p></script></p><p></head></p><p><body></p><p></p><p>Today's date is:</p><p></p><p><script language="JavaScript"></p><p><!-- hide me</p><p></p><p>// write the date</p><p>//</p><p>document.write(the_whole_date);</p><p></p><p>// show me --></p><p></script></p><p></p><p></body></p><p></html></p></blockquote><p></p>
[QUOTE="වින්ඩොස් 8, post: 13853280, member: 439987"] Program 3: Get today's date using the Date class. Print the date, month, and year. If the day is a weekday, print "uh..oh...it is a weekday". If the day is either Saturday or Sunday, print "Great...It is the weekend". Use the following methods: getFullYear ( ) - Retrieves the year component of the date as a 4-digit number. getMonth ( ) - Retrieves the month component of the date as a number from 0 to 11 (0=January, 1=February, etc) getDate ( ) - Retrieves the day-of-month component of the date as a number from 1 to 31 getDay ( ) - Retrieves the day of the week component of the date as a number from 0 to 6 (0=Sunday, 1=Monday, etc) Sample code: The following code prints today's date and month. <html> <head> <title>Write the Date</title> <script language="JavaScript"> <!-- hide me // get the date information // var today = new Date(); var the_day = today.getDate(); var the_month = today.getMonth(); // correct for the month starting from zero // the_month = the_month + 1; // create the string you want to print // var the_whole_date = the_month + "/" + the_day; // show me --> </script> </head> <body> Today's date is: <script language="JavaScript"> <!-- hide me // write the date // document.write(the_whole_date); // show me --> </script> </body> </html> [/QUOTE]
Insert quotes…
Verification
Hata thunen beduwama keeyada? (60 bedeema thuna)
Post reply
Top
Bottom