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

Seeking to get a programmer/ web developer for my websites, Programmer / We...

Programmer / Web Developer Seeking to get a Programmer/ Web Developer to do work on a few of my websites. Need be efficient and experienced in php and JavaScript. Job Desc

We are looking for web programmer, We are looking for Web Programmer We ...

We are looking for Web Programmer We are a design as well as marketing firm in need of web support. Fundamentally we will design the look of our clients' websites as well as

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

Need help to make checkout page customisation, Checkout Page Customisation ...

Checkout Page Customisation 1) Clone process need to be exact same as the reference checkout site 2) Final product must be responsive to all devices Desired Skills are MyS

Image gallery with facebook like button, Hello! I have cheak all over goog...

Hello! I have cheak all over google for a answere how i can greate a facebook like button into my php-gallery. I have download the gallery from here: And">http://www.e2interact

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

Social login plugin update for wordpress, Social login plugin update for wo...

Social login plugin update for wordpress We are looking to have this plugin updated to comprise a social login service that isn't on the list yet. Both the plugin service beside

Text-only web browsers, Text-only browsers: A text-only browser like Ly...

Text-only browsers: A text-only browser like Lynx let you to view Web pages without showing art or page structure. Fundamentally, you look at ASCII text onto a screen. The bene

Basic attributes of html, These all are attributes of the tag. The followi...

These all are attributes of the tag. The following instance explains each of these attributes. TARGET = "_blank

We need to incorporate data feed into wordpress site, We need to Incorporat...

We need to Incorporate data feed into wordpress site I want someone who can incorporate the following real estate data feed into my wordpress site. Once integrated, users must b

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