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

We are looking for an expert to support booking system, Booking Website REQ...

Booking Website REQUIRED We are looking for an expert to support us to complete our website on online booking system in this user will register and access the booking page. D

Class, how to create classes in php?

how to create classes in php?

I need help in wpmu appointment and customization, I need help in WPMU Appo...

I need help in WPMU Appointment and Customization I have a want for a ninja developer who knows the ins/outs of Appointment and can do the customization below- a) Facility to

Need to code checkout and payment process on back end of web, Need to code ...

Need to code Checkout and Payment Process on Back End of Website I have a website that wants to have a checkout as well as payment process coded into the back end. The website i

Dns server, Several computers linked to the Internet host part of the DNS d...

Several computers linked to the Internet host part of the DNS database & the software which allows others to access it. These all computers are known DNS servers. No DNS server has

Need help in creating forms in atlassian confluence, Need help in Creating ...

Need help in Creating forms in Atlassian Confluence We have installed Confluence and now to create some checklists and forms that our team can complete when working with clients

I need help in woocommerce and wordpress extra developemnt, I need help in ...

I need help in woocommerce and wordpress extra developemnt needed on existing website I have an existing website which I want some extra development on. It's a pretty simple cus

A script to spider and index a site needed, A Script to Spider and Index a ...

A Script to Spider and Index a Site, A Script to Search the Index I want a script that can take 1 or more URLs and spider and index a site. The script must essentially use an ex

I want help in styling live xml feed, Styling Live XML Feed Need the reo...

Styling Live XML Feed Need the reordering as well as styling of a short (dynamic) xml feed. The outcomes are to be showed within an external webpage. Further work is available s

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