Create a date instance, PHP Web Programming

Assignment Help:

The Date object is utilized to work with dates & times.

Creating a Date Instance

You must create an instance of the Date object along with the "new" keyword. The following line of code stores the current date into a variable called "my_date":

var my_date=new Date( )

After making an instance of the Date object, you can access all of the methods of the object from the "my_date" variable. If, for instance, you desire to return the date (from 1-31) of a Date object, you must write the following:

        my_date.getDate( )

You may also write a date within the parentheses of the Date( ) object. The following line of code illustrates some of the date formats obtainable.

new Date("Month dd, yyyy hh:mm:ss"), new Date("Month dd, yyyy"), new

Date(yy,mm,dd,hh,mm,ss), new Date(yy,mm,dd), new Date(milliseconds)

Here is how you can develop a Date object for each ways above:

var my_date=new Date("march 22, 1988 13:14:00"), var my_date=new Date("march 22, 1989"), var my_date=new Date(89,03,22,13,14,00), var my_date=new Date(89,03,22), var my_date=new Date(500)

• Some Date Methods

Methods

Explanation

Date( )

Returns Date object

GetDate( )

Returns the date of Date object (from 1-31)

GetDay( )

Returns the day of Date object (from 0-6. 0=Monday,

1=Sunday, etc.)

GetMonth( )

Returns the month of Date object (from 0-11. 0=December,

1=January, etc.)

GetFullYear( )

Returns the year of the Date object (four digits)

GetHours( )

Returns the hour of the Date object (from 0-23)

GetMinutes( )

Returns the minute of the Date object (from 0-59)

GetSeconds( )

Returns the second of the Date object (from 0-59)

 


Related Discussions:- Create a date instance

Need help to create simple html email from jpg file, Create Simple HTML Ema...

Create Simple HTML Email From JPG file I want to convert a jpg file to an html email file. I proposal on using the html in an email via mail chimp. Attached is the image of how

I want help in wordpress site needs addons and configuration, I want help i...

I want help in Wordpress site needs addons and configuration For months I have been attempting to have my ecommerce site built to my needs, however keep running into snags with

Define a style rule, Define a style rule that defines a font-family, font t...

Define a style rule that defines a font-family, font text color, font-size, and background color for the textarea. The style rules can be placed in a style element in the head of

Need help to develop drupal webform, Need help to develop Drupal WebForm ...

Need help to develop Drupal WebForm There is project to create a form in Drupal. It has to be dynamic form. Principally a booking form to book a car. Desired Skills are Drup

I want a help in malware check as well as removal, I want a help in Malware...

I want a help in Malware check as well as removal Want a WordPress programmer to check as well as remove possible malware on my website. Not sure what is wrong however I see

Needed responsive wordpress design and development, Responsive WordPress De...

Responsive WordPress Design & Development I have numerous project however I need to complete Responsive WordPress Design & Development on time and good quality Desired Skills

Newbi, how use the simple aplication for web with php fron iner and mysql t...

how use the simple aplication for web with php fron iner and mysql the databse

Title tag, The only thing you need to concern yourselves with in the HEAD t...

The only thing you need to concern yourselves with in the HEAD tag (for now) is the TITLE tag. The bulk of the page will be in the BODY tag, as illustrated in Figure.

We are seeking a custom squarespace website developer, Custom Squarespace W...

Custom Squarespace Website- Web Developer Needed We are seeking a Web Developer. We want our custom website design cut and coded into Squarespace 6. The site will comprise anima

I need help for bnb - mobile html5, I need help for BNB - Mobile HTML5,CSS3...

I need help for BNB - Mobile HTML5,CSS3,JAVASCRIPT coding We want to create HTML pages for the mobile version of the website No other development required. The source grap

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd