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

Distinguish between complex type and simple type elements, Question: (a...

Question: (a) Explain the concept of "mixed content" in an XML document. What restrictions are placed on the definition of elements with mixed content by Document Type Defini

We need help to make site similar as youtube, YouTube like video ads We ...

YouTube like video ads We have an current website for video hosting where users can upload the videos (just like a smaller version of YouTube) and its in PHP. We need to setu

We need help to build bidding style website, We need help to build Bidding ...

We need help to build Bidding style Website I want a bidding style website. Yet the target market is bidding on something different. I would want a paid membership area and a fr

App developer needed, App Developer Needed a) Excellent coding skills fo...

App Developer Needed a) Excellent coding skills for developing an app that can work for IPhone and/ or Android. b) Creative and team player. c) Hardworking and passionate.

Looking for a facebook app developer to build facebook, Facebook app develo...

Facebook app developer Looking for a Facebook app developer to build Facebook Application but with some additional features and add-ons. The app developer wants experience in

Need experienced wordpress developer to work on our site, Need Experienced ...

Need Experienced Wordpress Developer to Work on Our Site We are in search of an experienced as well as somebody with advanced level of Wordpress familiarity to help us with your

I need a website designing, Website Designing Want to revamp an existing...

Website Designing Want to revamp an existing website Job description- Need to change the look of an existing website therefore that it can have greater hits Web developmen

I need a web developer develop a simple corporate responsive, I need a Web ...

I need a Web Developer Start-up company in Tel Aviv is looking for a talented Web Developer to develop a simple (no backend) corporate responsive website of 5 Pages Job descript

Create a web page which contains an image, 1. Develop an HTML code to creat...

1. Develop an HTML code to create a Web page of blue color & display links in red color. 2. Develop an HTML code to create a Web page which contains an image at its center.

Describe the term symbols, Question: 1. What is the name of the progra...

Question: 1. What is the name of the programming /scripting language of Flash? 2. Which HTML tag can be used to insert a Flash movie in a web page? 3. While working wi

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