Ok, I know this isn''t a Rails problem, but if you could help me out that''d be brill. I''ve used JavaScript to create a new Date object containing a date of my choice... mydate = new Date("11/24/2007"); //going with Javascript''s mm/dd/yyyy format now this is good, what i want to do now is put in an integer variable the number for the day, in this case 24 Now if i use JavaScript''s getDay() function it will return the numeric day of the week for that day (e.g. 2 for Monday). what i really want is the numeric day for that date, aka 24 Looked around and Javascript doesn''t have a .day element. Any ideas how I can accomplish this in JavaScript ? Appreciate this, really, John. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
This works, it''s hackish but it works. date = new Date("11/24/2007"); date.toDateString().split(" ")[2]; Make sure you have the space between the " " in the split function Merry xmas, Cam On Dec 24, 8:35 am, John Griffiths <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ok, I know this isn''t a Rails problem, but if you could help me out > that''d be brill. > > I''ve used JavaScript to create a new Date object containing a date of my > choice... > > mydate = new Date("11/24/2007"); > //going with Javascript''s mm/dd/yyyy format > > now this is good, what i want to do now is put in an integer variable > the number for the day, in this case 24 > > Now if i use JavaScript''s getDay() function it will return the numeric > day of the week for that day (e.g. 2 for Monday). > > what i really want is the numeric day for that date, aka 24 > > Looked around and Javascript doesn''t have a .day element. > > Any ideas how I can accomplish this in JavaScript ? > > Appreciate this, really, > > John. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 23, 2007, at 3:35 PM, John Griffiths wrote:> > Ok, I know this isn''t a Rails problem, but if you could help me out > that''d be brill. > > I''ve used JavaScript to create a new Date object containing a date > of my > choice... > > mydate = new Date("11/24/2007"); > //going with Javascript''s mm/dd/yyyy format > > now this is good, what i want to do now is put in an integer variable > the number for the day, in this case 24 > > Now if i use JavaScript''s getDay() function it will return the numeric > day of the week for that day (e.g. 2 for Monday). > > what i really want is the numeric day for that date, aka 24 >Oh, you were so close! getDate() Phillip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sorry, I forgot to add a nice reference URL: http://www.w3schools.com/jsref/jsref_obj_date.asp Peace, Phillip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
ugh.... i feel so stupid ;-) thank philip, have a happy christmas John. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Can''t you do: myDate = getDate("11/24/2007"); MyDate.day(); Or am I dreaming? On Dec 24, 2007 8:56 AM, Phillip Koebbe <phillipkoebbe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Sorry, I forgot to add a nice reference URL: > > http://www.w3schools.com/jsref/jsref_obj_date.asp > > Peace, > Phillip > > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 23, 2007, at 4:49 PM, Ryan Bigg wrote:> Can''t you do: > > myDate = getDate("11/24/2007"); > MyDate.day(); > > Or am I dreaming? ><imagine the sound of your alarm going off> day() is not a function. getDay() returns the ordinal day of week. getDate() returns the day of the month. Peace, Phillip --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> <imagine the sound of your alarm going off> >So that''s what I get for it being a Monday, Christmas Eve no less. *remembers to consult web before suggesting things* --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
;-) you guy''s are the best! if you ever get near my part of the world, drop me a line, beer''s most definitely on me, have a smashing christmas! John. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Define "part of the world" On Dec 24, 2007 8:47 PM, John Griffiths <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > ;-) > > you guy''s are the best! > > if you ever get near my part of the world, drop me a line, beer''s most > definitely on me, > > have a smashing christmas! > > > > John. > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ah I totally missed that getDate() funtion as well. That''ll teach me for not reading more closely.... Glad it worked out for you. Cam On Dec 24, 10:13 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Define "part of the world" > > On Dec 24, 2007 8:47 PM, John Griffiths <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > > > > > ;-) > > > you guy''s are the best! > > > if you ever get near my part of the world, drop me a line, beer''s most > > definitely on me, > > > have a smashing christmas! > > > John. > > -- > > Posted viahttp://www.ruby-forum.com/. > > -- > Ryan Bigghttp://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> getDate()What a poorly named function! ///ark --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---