Date is a very useful object that returns the date and time of the system in the following format: Weekday, month name, Month Day, Hour:Minute:Second and Year. As any object, you can create new instances and this practice enables the use of how many date objects are required.

The instance of the object is given as follows:

NewObject = NEW date ()

  • NewObject = Object defined by user to handle dates

The Date object has a number of methods that aim to assist in identifying important temporal elements.

 

getMonth – Gets the number of the month, returning a value between 0 and 11 (January = 0)

Eg: Month = NewObject.getMonth ()

 

setMonth – Sets a new value for the month. The value must be between 0..11

Eg.: NewObject.setMonth (NumeroDoMes)

 

getDate – Gets the number of the day, considering the month, returning a numeric value between 1..31.

Eg.: day = NewObject.getDate ()

 

setDate – Sets a new value for the date. This value should be between 1..31

Eg.: NewObject.setDate (NumeroDoDia)

 

getDay – Gets the number of the day, considering the week, returning a numeric value between 0..6. Remember that the week starts on Sunday, so 0 is Sunday

Eg.: DayOfWeek = NewObject.getDay ()

 

getHours – Gets a number corresponding to time, returning a numeric value between 0..23

Eg.: Time = NewObject.getHours ()

 

setHours – Sets a new value for the hour. The value must be between 0..23

Eg.: NewObject.setHours (datetime)

 

getMinutes – Gets a number corresponding minutes, returning a numeric value between 0..59

Eg.: Minutes = NewObject.getMinutes ()

 

setMinutes – Sets a new value for minutes. The value must be between 0..59

Eg.: NewObject.setMinutes (Minutes)

 

getSeconds – Gets a number corresponding to the second, returning a numeric value between 0..59

Eg.: Seconds = NewObject.getSeconds ()

 

setSeconds – Sets a new value for the seconds. The value must be between 0..59

Eg.: NewObject.setSeconds (seconds)

 

getTime – Gets the time from 01/01/70 to date. The only drawback is that this date is given in milliseconds.

Eg.: ElapsedTime = NewObject.getTime ()

 

setTime – Establishes a new date.

Eg: BirthDate = new Date (“August 2, 1970”)

 

getTimezoneOffset – Gets the difference between local time and the time of the central meridian (Greenwich). This time is given in minutes, just to find out the time zone, you must divide the result obtained by this function for 60.

Eg.: Timezone NewObject.getTimezoneOffset = () / 60

 

getYear – Gets a numerical value corresponding to the year.

Eg.: Year = NewObject.getYear ()

 

setYear – Establishes a new value annually. The value should be greater than or equal to 1900.

Eg.: NewObject.setYear (1997)

 

toGMTString – Converts a date object to a string following the pattern Internet GMT.

Eg.: NewObject.toGMTstring ()

 

toLocaleString – Converts a date to a string following the local standard.

Eg.: NewObject.toLocalString ()

You might also like…

PROCESAMIENTO AJAX EN SCRIPTCASE

Ajax en los formularios de Scriptcase puede usarse para recargar un campo de tipo de select basado e...

IMPORTAR IMAGENES DE LA BASE DE DATOS Y UTILIZAR CLASES DE BOOSTRAP

Como muchas personas ya saben, Bootstrap es una biblioteca de front-end libre y de código abierto p...

TENDENCIAS DE DESARROLLO WEB PARA 2017

Usted verá en este post tendencias para 2017 en Diseño Web, en el medio digital y en el desarrollo...

Comment this post

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at sales@scriptcase.net. Learn more about our Privacy Police.