Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Date Object In Javascript

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 29-01-2010
Member
 
Join Date: Nov 2009
Posts: 862
Date Object In Javascript
  

Hello, I want to know the details about the Date object in java script. I have search different online tutorials about it, but It is quiet complicated to know it. So, if you provide me some basic information about it, then I can able to know more about the date object. So, please provide me either script related to it or just provide me point wise details.

Reply With Quote
  #2  
Old 29-01-2010
Member
 
Join Date: Apr 2008
Posts: 1,947
Re: Date Object In Javascript

The object Date can work with all variables affecting dates and time management. It is an object included natively in JavaScript, and that we can always use. The date is stored in a variable as a string that contains the day, month, year, hour, minutes and seconds. It is therefore difficult access to only one element of an object dateSince each element can have a variable size. Fortunately, the methods of the object Date provide a simple way to access a single item, or to modify it. Their syntax is as follows:
Code:
Objet_Date.Methode ()
Reply With Quote
  #3  
Old 29-01-2010
Member
 
Join Date: May 2008
Posts: 2,007
Re: Date Object In Javascript

The syntax for creating an object-date may be one of the following:
  • First = new Date ()
    This syntax is used to store the date and time current
  • Second = new Date ( "month day, year hours: minutes: seconds)
    parameters are a string in this notation
  • Third = new Date (year, month, day)
    parameters are three integers separated by commas.
    Omitted parameters are set to zero by default
  • Fourth = new Date (year, month, day, hours, minutes, seconds)
    parameters are six integers separated by commas.
    Omitted parameters are set to zero by default
Reply With Quote
  #4  
Old 29-01-2010
Member
 
Join Date: Apr 2008
Posts: 2,000
Re: Date Object In Javascript

Date Object In Javascript provides you the following methods:
  • getDate ()
  • getDay ()
  • getHours ()
  • getMinutes ()
  • getMonth ()
  • getTime ()
  • getTimezoneOffset ()
Reply With Quote
  #5  
Old 29-01-2010
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: Date Object In Javascript

If you want to change the Date object format in your output then you must need to make use of the mehod below:
  • toGMTString ()
  • toLocaleString ()
If you want to change the Date which is already exist in the database then yo must need to make use of the mehod below:
  • setDate (<DATE>)
  • setDay (<DATE>)
  • setHours (<DATE>)
  • setMinutes (<DATE>)
  • setMonth (<DATE>)
  • setTime (<DATE>)
Reply With Quote
  #6  
Old 29-01-2010
Member
 
Join Date: May 2008
Posts: 2,290
Re: Date Object In Javascript

If you make use of the date object in the javascript then it will work with the date and time. If you want to create the date object then simply create a Date() constructor as below:
Code:
<h2>It is now  
<script type="text/javascript">
<!--
var currT = new Date()
var mon = currT.getMonth() + 1
var day = currT.getDate()
var yer = currT.getFullYear()
document.write(month + "/" + day + "/" + year)
//-->
</script>
</h2>
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Date Object In Javascript"
Thread Thread Starter Forum Replies Last Post
How to setup a JavaScript Object Notation variable? hatred Software Development 4 04-02-2010 01:25 AM
JavaScript - The window object Sheenas Software Development 5 29-01-2010 10:38 AM
History Object In JavaScript ramsun Software Development 5 29-01-2010 09:17 AM
Location Object In JavaScript technika Software Development 5 23-01-2010 08:24 AM
JavaScript: RegExp and Boolean Object Ivann Software Development 5 18-12-2009 02:36 AM


All times are GMT +5.5. The time now is 03:30 AM.