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

Want a simple html form having pagedown plugin, Need a simple html form hav...

Need a simple html form having pagedown plugin I want an html form having pagedown plugin in it. There must be submit button on the form which when pressed take submits the edit

Need help rtl open cart without payment model, RTL Open Cart without paymen...

RTL Open Cart without payment model I want the following for a client- 1) Open Cart store 2) User must be logged in to make an order (obviously), but- 3) No Payment mod

Project, how much does it cost per one project?

how much does it cost per one project?

We need developer for modifying a website, We are looking for a very skille...

We are looking for a very skilled php developer to help us make modifications to our website. Job Description- We are looking for a Web Developer. Your responsibilities- 1

I want a jquery mobile template creation expert, I am looking for a Jquery ...

I am looking for a Jquery mobile expert with strong css skills who has created Jquery ui and Jquery mobile plugins before as well as utilized other advanced java-script and CSS pro

I need help in website online designer work, I need help in Website Online ...

I need help in Website Online Designer Work I have a website that I paid to get done about three years ago and really have not been able to use it because it doesn't work proper

Bookboon look for experienced expert web-developer, Bookboon look for exper...

Bookboon look for experienced expert Web-developer Bookboon.com is presently the biggest eBook publisher in the world where we last year distributed 56 million ebooks. Bookbo

Unordered lists, First one, we will create an unordered list. These lists a...

First one, we will create an unordered list. These lists are also called as bulleted lists. These lists are characterized through list items that do not have numbers. They are used

Input text field, The field size attribute determines the width of the disp...

The field size attribute determines the width of the displayed field. The maxlength attribute sets a limit on the maximum number of characters that can be typed in the field (whic

I am in need of flash video streaming expert, I am in need of Flash Video S...

I am in need of Flash Video Streaming expert I own a premium PHP, MySQL as well as Adobe Flash video chat room website. I want someone with real experience that can make improve

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