Lee D'oéjgi
2009-Mar-14 00:49 UTC
Transforming DateTime in this format: Fri Mar 13 13:00:52 -0700 2009
I''m trying to reformat the following DateTime: ''Fri Mar 13 13:00:52 -0700 2009'' to be ''2009-03-13 13:00:42'', but can''t quite seem to get it. I''ve tried strftime(''%a %b %d %H %M %S -0700 %Y'') amongst other things and google isn''t helping... Any advice? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
senthil raja
2009-Mar-14 16:47 UTC
Re: Transforming DateTime in this format: Fri Mar 13 13:00:52 -0700 2009
You have to use double quotes use strftime("%Y-%m-%d %H:%M:%S") Regards Senthil Raja S P On Sat, Mar 14, 2009 at 6:19 AM, Lee D''oéjgi <leedoejgi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m trying to reformat the following DateTime: ''Fri Mar 13 13:00:52 -0700 > 2009'' to be ''2009-03-13 13:00:42'', but can''t quite seem to get it. I''ve > tried strftime(''%a %b %d %H %M %S -0700 %Y'') amongst other things and google > isn''t helping... > > Any advice? > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Colin Law
2009-Mar-14 17:21 UTC
Re: Transforming DateTime in this format: Fri Mar 13 13:00:52 -0700 2009
2009/3/14 senthil raja <seja83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> You have to use double quotes > > use strftime("%Y-%m-%d %H:%M:%S") >It is not necessary to use double quotes, single quotes are ok. It is only a string.> > Regards > Senthil Raja S P > > > On Sat, Mar 14, 2009 at 6:19 AM, Lee D''oéjgi <leedoejgi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> I''m trying to reformat the following DateTime: ''Fri Mar 13 13:00:52 -0700 >> 2009'' to be ''2009-03-13 13:00:42'', but can''t quite seem to get it. I''ve >> tried strftime(''%a %b %d %H %M %S -0700 %Y'') amongst other things and google >> isn''t helping... >> >What is it that you are calling strftime on (show us some code), and what result do you get when you call it as you have shown? Colin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
senthil raja
2009-Mar-16 04:59 UTC
Re: Transforming DateTime in this format: Fri Mar 13 13:00:52 -0700 2009
For eg) Time.now.strftime("%Y-%m-%d %H:%M:%S") will results 2009-03-16 10:00:42 On Sat, Mar 14, 2009 at 10:51 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> 2009/3/14 senthil raja <seja83-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >> You have to use double quotes >> >> use strftime("%Y-%m-%d %H:%M:%S") >> > > It is not necessary to use double quotes, single quotes are ok. It is only > a string. > > >> >> Regards >> Senthil Raja S P >> >> >> On Sat, Mar 14, 2009 at 6:19 AM, Lee D''oéjgi <leedoejgi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> I''m trying to reformat the following DateTime: ''Fri Mar 13 13:00:52 -0700 >>> 2009'' to be ''2009-03-13 13:00:42'', but can''t quite seem to get it. I''ve >>> tried strftime(''%a %b %d %H %M %S -0700 %Y'') amongst other things and google >>> isn''t helping... >>> >> > What is it that you are calling strftime on (show us some code), and what > result do you get when you call it as you have shown? > > Colin > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Priya Buvan
2009-Mar-16 08:32 UTC
Re: Transforming DateTime in this format: Fri Mar 13 13:00:52 -0700 2009
Lee D''oéjgi wrote:> I''m trying to reformat the following DateTime: ''Fri Mar 13 13:00:52 > -0700 > 2009'' to be ''2009-03-13 13:00:42'', but can''t quite seem to get it. I''ve > tried strftime(''%a %b %d %H %M %S -0700 %Y'') amongst other things and > google > isn''t helping... > > Any advice?If the value is array or string, first convert that into datetime format and try with using strftime(needed format). -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---