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

Jquery animations for website help needed, Finish JQuery Animations for Web...

Finish JQuery Animations for Website I am seeking a resources in the US that can work US hours ASAP to finish a couple JQuery animations for our website. The animations are pret

Create a web page that prompt the user for input, Overview Web pages often...

Overview Web pages often need to prompt the user for input and that input will then need to be uploaded to the server, processed, possibly stored, and then some appropriate result

Web development for art website, Web development for company We need to ...

Web development for company We need to build a website for a start-up company doing event planning relating to fashion and arts. In this website we would like to have the follow

Need help for online tutoring platform, Online Tutoring platform I am se...

Online Tutoring platform I am seeking to have a website designed as well as programmed that will allow students and tutors to connect and work together on an online platform wit

Explain features of php, Question: (a) (i) Name four features of PHP t...

Question: (a) (i) Name four features of PHP that makes it an appropriate choice as a Web programming language. (ii) List advantages while using PHP scripting language.

Need help to make api changes, Need help to make API changes a) All work...

Need help to make API changes a) All work submitted via github b) All time billed using workview Want adjustments to custom scripts for ebay APIs: a) Download part numb

We need a developer for web app, We need a developer for web app We are ...

We need a developer for web app We are looking for a full stack developer or a team for building our web application. I want to import CSV files as well as output Excel spreadsh

Need help for merging databases, Merge Databases I have a website in Wor...

Merge Databases I have a website in Wordpress and within it I have a vBulletin forum. I have an external MAGENTO store that I'll move to my chief website. What I'd like to do is

Need a expert wordpress programmer and designer, Need a Expert Wordpress Pr...

Need a Expert Wordpress Programmer and Designer We are in search of an ongoing wordpress expert designer and programmer for ongoing tasks. For this project you will make an auth

Want support to make membership opt-in page, Want support to make Membershi...

Want support to make Membership Opt-in Page When fresh members sign up for Femworking membership they do consequently through a PayPal button. It works great however what I'm mi

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