SmokingMan Posted February 13, 2006 Share Posted February 13, 2006 I'm having some trouble understanding the Date Object syntax. I understand the "get" & "set", but what is it that goes before the date object? In "dateObj.setTime()", what is it that you put in place of "dateObj"? Is it a variable of my choosing? Or are there certain keywords that need to be used in this instance? I don't know why I'm having so much trouble getting this into my little pea brain, but right now it's about as clear as mud.Any and all help would be greatly appreciated. Link to comment Share on other sites More sharing options...
aspnetguy Posted February 13, 2006 Share Posted February 13, 2006 I'm having some trouble understanding the Date Object syntax. I understand the "get" & "set", but what is it that goes before the date object? In "dateObj.setTime()", what is it that you put in place of "dateObj"? Is it a variable of my choosing? Or are there certain keywords that need to be used in this instance? I don't know why I'm having so much trouble getting this into my little pea brain, but right now it's about as clear as mud.Any and all help would be greatly appreciated.<{POST_SNAPBACK}> I don't work with the dateobject much but the samples you have there seem wrong. Is this from the w3schools tutorials??? Link to comment Share on other sites More sharing options...
SmokingMan Posted February 14, 2006 Author Share Posted February 14, 2006 No, they are from the JavaScript Bible v5. Here's the table I was looking at: Table 10-1: Some Date Object MethodsMethod---Value---Range DescriptiondateObj.getTime() 0-... Milliseconds since 1/1/70 00:00:00 GMTdateObj.getYear() 70-... Specified year minus 1900; four-digit year for 2000+dateObj.getFullYear() 1970-... Four-digit year (Y2K-compliant); version 4+ browsersdateObj.getMonth() 0-11 Month within the year (January = 0)dateObj.getDate() 1-31 Date within the monthdateObj.getDay() 0-6 Day of week (Sunday = 0)dateObj.getHours() 0-23 Hour of the day in 24-hour timedateObj.getMinutes() 0-59 Minute of the specified hourdateObj.getSeconds() 0-59 Second within the specified minutedateObj.setTime(val) 0-... Milliseconds since 1/1/70 00:00:00 GMTdateObj.setYear(val) 70-... Specified year minus 1900; four-digit year for 2000+dateObj.setMonth(val) 0-11 Month within the year (January = 0)dateObj.setDate(val) 1-31 Date within the monthdateObj.setDay(val) 0-6 Day of week (Sunday = 0)dateObj.setHours(val) 0-23 Hour of the day in 24-hour timedateObj.setMinutes(val) 0-59 Minute of the specified hourdateObj.setSeconds(val) 0-59 Second within the specified minuteI was just unsure as to what the "dateObj" represented, and if it was required, a reserved word, or a variable of my choosing. Link to comment Share on other sites More sharing options...
Chocolate570 Posted February 14, 2006 Share Posted February 14, 2006 dateObj just means the object that represents your date. Date obj can be 'llamapalooza' as long as you do this at the beginning of your script:llamapalooza = new Date(); Link to comment Share on other sites More sharing options...
aspnetguy Posted February 14, 2006 Share Posted February 14, 2006 ok I understand now Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now