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

Draw layout cells, In Layout view you can draw layout cells & layout tables...

In Layout view you can draw layout cells & layout tables to describe the design areas of a document. This task is easier to achieve if you prepare a sample of the page you're creat

Ftp service, FTP understands two basic file formats only. It classifies eve...

FTP understands two basic file formats only. It classifies every file either a binary file or a text file. A text file has a sequence of characters gather into lines. Though comput

Web developer needed because current developer discontinued, Web Developer ...

Web Developer I have a website that I was functioning on with the developer for a very long time to build this site. They are no longer free/available to work on it and I really

I need help to develop drupal rooms, I need help to develop Drupal Rooms ...

I need help to develop Drupal Rooms I have a website I build it with Drupal for Rent apartments, I have five buildings in different places Every building have different capacity

I want a video player thumbnail script, Video player/thumbnail swap-out scr...

Video player/thumbnail swap-out script needed I want a video player thumbnail script. There will be one big, main video, adjacent to either three or four thumbnails of other vid

Fashion luxury brand website design and development, Fashion Luxury Brand W...

Fashion Luxury Brand Website Design and Development I want someone to design and implement a website for a high end luxury fashion label that I am launching which at the moment

Need help in php mysql connection, PHP MySQL connection (Digital Ocean) ...

PHP MySQL connection (Digital Ocean) I devour a server in Digital Ocean cloud with fresh install of Apache, MySQL 5.6, PHP 5.3, Centos 6.4 (64 bit). Want to setup MySQL Workbenc

Standard internet protocol, FTP (File Transfer Protocol), a standard Intern...

FTP (File Transfer Protocol), a standard Internet protocol. This is the simplest way to exchange files among computers on the Internet. FTP is an application protocol which uses th

Develop an orientation programme, Assume the position of a consultant hired...

Assume the position of a consultant hired to assess the approach towards orientation and induction programmes for new recruits of an organization that is engaged in manufacturing a

Wordpress developer required for website, Wordpress developer required S...

Wordpress developer required Searching good wordpress developer or else team for long term and more projects we outsource our jobs to good freelancers and its regular jobs. a

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