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

I need help in php, I need help in PHP, Wordpress Developer - with Mixpanel...

I need help in PHP, Wordpress Developer - with Mixpanel I'm changing from using Aweber for email management to Mixpanel. I want you to grow a WordPress plugin that will allow

Need a wordpress expert, Need a Wordpress expert We're seeking a talente...

Need a Wordpress expert We're seeking a talented well experience Wordpress expert with strong PHP skills to build a website with integration with Salesforce and an advanced even

Need help in wordpress website migration and move, Wordpress website migrat...

Wordpress website migration / move We have a word press site that is not working with the duplicator plugin. We just want it shifting across to some new hosting. Must just

Initial designs for a web page , A Neighbourhood watch  (a community based ...

A Neighbourhood watch  (a community based 'watch your neighbour'  organisation to keep the neighbourhood safe) committee in the Tuggeranong valley  (ACT) has grown to the stage whe

Need help in event web based program using php, EVENT Web Based Program usi...

EVENT Web Based Program using PHP We are seeking someone who is qualified in using the PHP to develop an Event Management program which arrange of payments via systems like PayP

I need help in cakephp, CakePHP, OAuth, Video APIs I want somebody who h...

CakePHP, OAuth, Video APIs I want somebody who has familiarity in CakePHP to work on a project that requires OAuth incorporation with various sites and then post videos to these

Radio button, Radio buttons are used while only one out of the group of cho...

Radio buttons are used while only one out of the group of choice is to be selected. In the example code we have put a line break after every button. Each of the Radio Buttons ha

Needed a magento virtual assistant, MAGENTO VIRTUAL ASSISTANT Our websit...

MAGENTO VIRTUAL ASSISTANT Our website is constructed on MAGENTO Platform. We want an individual with strong knowledge of MAGENTO Back end office to look after our website, up

Asp.net and mvc clinic system, Project Description: Web-based clinic man...

Project Description: Web-based clinic management system with patient casenote , inventory and invoicing management. The developer we are seeking is someone experienced with ASP.

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