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

Php Script to Parse out Custom Lines from Log FilE, i''m trying to code a s...

i''m trying to code a simple php script to parse out custom lines from an log file and echo that line here''s an example of a line from the log file 192.168.182.1 - - [13/Jul/20

We need help for ongoing developer work using portal, We need help for Ongo...

We need help for Ongoing Developer work using portal 8 Seeking a developer who has moderate to extensive experience working with Portal 8 to help build custom template websites.

A computer/website programmer, A computer/website programmer I am in sea...

A computer/website programmer I am in search of a professional to make me a website on which I could sell computer programs through credit or debit card and as well sell physica

Need to make responsive website, Need to make RESPONSIVE WEBSITE NEEDED- Ad...

Need to make RESPONSIVE WEBSITE NEEDED- Adjustments to existing site I presently have a website template with a company called Bludomain. I need to host with another company as

We need help to create ecommerce and software app, We need help to create E...

We need help to create Ecommerce and Software App Development For Yahoo / Shopify I am in search of a developer or company to build an App that can work with Yahoo Stores and Sh

We are looking for a web developer to edit website and apps, We are looking...

We are looking for a Web Developer to edit website and apps Ok as well as the features what apps and site must have now is (1. Voice post 2. 3d blog 3. All members will have poi

We are in need web app developer for api and scraping site, We are in need ...

We are in need Web app developer for api and scraping website For a website project I am in search of a part time developer Project The creation of a website as well as im

Design and implement a frame-based personal web page, Design and implement ...

Design and implement a frame-based personal Web page. Include everything that you would like to share with your friends. This must include but not limited to: A short biogra

Need help in php programmer with codeigniter exp, PHP Programmer with CodeI...

PHP Programmer with CodeIgniter exp CodeIgniter and PHP Programming We want highly talented individuals to work with our company. You must be- Puntual Honest Resp

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

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