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

Need help flash and audio streaming with recording, Flash and Audio Streami...

Flash and Audio Streaming with Recording I need to add audio streaming as well as recording feature to my chat application. This is additional feature. Chat application has b

Need drupal expert to check website downtime after migrating, Need Drupal e...

Need Drupal expert to check website downtime after migrating to drupal 7.0 CMS We are looking for help to check on our website which has been experiencing intermittent downtime

W3 total cache on wp ecommerce website configuration, W3 Total Cache on WP ...

W3 Total Cache on WP Ecommerce website configuration I want configuration done on my Ecommerce website with W3 Total Cache. When you select a product the widget will not update

In search of a developer team to build advanced website, In search of a dev...

In search of a developer team to build advanced website with two web applications In search of an experienced team to build a state of the art website for my hair company that i

I want a python developer for web application, Python developer for web app...

Python developer for web application We are a US based starting with a live web app developed using great Python web MVC framework. The current code base was written by a senior

Gravity forms wp expert wanted to re-program form, Gravity Forms WP Expert ...

Gravity Forms WP Expert Wanted To Re-Program Form We want a TRUE WordPress/Gravity Forms developer who is expert at customizing a form with a specific UI/Look as well as Feel. O

Need web developer/programmer for unique lead gen website, Seeking Web Deve...

Seeking Web Developer/Programmer for unique lead gen website a) Potential customers come to website and post services they need b) Providers make offers to post c) Both cu

Responsive wordpress design and development, Responsive WordPress Design & ...

Responsive WordPress Design & Development I have numerous project but you need complete on time and good quality Desired Skills are CSS, HTML, PHP, WordPress

Needed mobile wordpress expert, Mobile Wordpress Expert Seeking a person...

Mobile Wordpress Expert Seeking a person that is very good at installing wordpress themes from themeforest and making sure that they look GREAT on Mobile Devices. Please disp

Needed web design and programming for small project, Web Design/Programming...

Web Design/Programming (small project) Seeking strong CSS/HTML/Bootstrap skills for a small update to an existing webpage. Existing page wants overall UI updates/content mark

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