![]() CATEGORIES: BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism |
Array Object Methods
Date andTime There are four different Date Constructorsthat you can use to create an instance of the DateObject and they are listed below. If you supply no Arguments, then the default version is used with the current date and time in GMT format. The second Date Constructortakes a Stringas the Argument in the format listed in the syntax or recognizedby the Static parse()Method. The third and fourth Date Constructorstake integersasArguments. The hours, minutes, and secondsArguments are optional, and zero, if omitted. Date Constructors Syntax: new Date() //default version new Date("month day, year [hours:minutes:seconds]") //String Values new Date(year, month, day) //Integer Values new Date(year, month, day[, hours, minutes, seconds]) //Integer Values The initializeTime()Function constructs a new instance of the DateObject with the newOperator and the Date()Constructor and converts it from the number of milliseconds that have elapsed since January 1, 1970, to a usable format in general use for any particular geographical region by using the toLocaleString()Method. It is then assigned to the valueProperty of the Textfield named TextTimeby calling the output() Function. Then the process is repeated so that the time is updated every second by using thesetTimeout()Method, which calls the initializeTime()Function every 1000 milliseconds, which is, of course, every second. Finally the BeenHereXT()Function constructs a new instance of the DateObject namedlater, which is always the current time because the setTimeout()Method causes a newDateObject to be constructed each time it calls the BeenHereXT()Function, which is once per second. .
Date: 2016-01-03; view: 1064
|