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

Display ads as well as native ad server and advertiser, Display Ads as well...

Display Ads as well as Native Ad Server and Advertiser and Publisher Tools This project has two tasks- a) Build an ad-serving solution as well as analytics dashboard for disp

Create the rollover image for navigation buttons, 1. In the Document window...

1. In the Document window, click on the second navigation button cell; then in the Common category of the Objects panel, click on the Insert Rollover Image icon. 2. Within the I

Required skilled d3.js programmer, Need skilled d3.js programmer Seeking...

Need skilled d3.js programmer Seeking skilled programmer to work on SaaS prototype. Please offer proof of experience in the form of verifiable work and references. Desired Sk

Market value targeted to regions or countries, A website that permits you t...

A website that permits you to enter data for a specific product make and model and perform a search on multiple websites, of any kind to generate a report of the different prices,

Responsive wordpress design and development, Responsive WordPress Design & ...

Responsive WordPress Design & Development I have numerous project but you need complete on time and good quality Desired Skills are CSS, HTML, PHP, WordPress

Formatting of text, Text formatting, in other terms presenting the text on ...

Text formatting, in other terms presenting the text on an HTML page in a wanted manner, is significant part of developing a web page. Let us understand how we can lay out of text c

I need help to move hosting, Move Hosting To Google hosting where I am c...

Move Hosting To Google hosting where I am capable to host for free. There is a way to host on Google for free if you do not have too much traffic. You will need to back up the

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

Need help in personal account component for joomla, Personal account compon...

Personal account component for Joomla It is essential to develop a component for CMS Joomla which will permit visitors of a site to receive necessary information of financial ch

Dynamic pages, These are those where the content of the web page based on u...

These are those where the content of the web page based on user input. Thus interaction with the user is needed in order to display the web page. For instance, consider a web page

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