Thanks will try both suggestions and let you know what comes of it.

I actaully noticed the problem becuase my time column in one of my
models was not getting saved. It kept being save as nil. Could the
problem relate to different databases being used? On my local, I use
sqlite vesus PostGre on Heroku. Really, all I am trying to do is using
a javascrpt plugin to allow users to choose a time and date which
comes in the form of "day/month/year hour:minute am/pm" and then save
it to the db.

It seems strange non one else has come accross this... make me think
it is something specific to what I am doing.

Will keep you posted.

On Feb 15, 12:22 am, "Tom O'Neill" <[email protected]> wrote:
> If you know the format of the string you want to parse, strptime is a good
> option:
>
> DateTime.strptime(dateWithTz, '%m/%d/%Y %z')
>
> Tom
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of
>
> kowsik
> Sent: Tuesday, February 14, 2012 8:30 PM
> To: [email protected]
> Subject: Re: Time Parse Problem
>
> You should do 'bundle exec irb' locally and then require the gems (specific
> versions) declared in your Gemfile. Is it possible that you have newer gems
> locally that are affecting the time?
>
> We recently added a campfire gem to our Sinatra app that started using
> something other than json/ext which ended up changing our time formats when
> serialized to JSON. Took a while to track down.
>
> K.
> ---http://blitz.io
> @k1sw0k
>
> On Tue, Feb 14, 2012 at 8:13 PM, tashfeen.ekram <[email protected]>
> wrote:
> > It seems like the Time.parse function behaves differently on my local
> > machine versus on Heroku.
> > When given the date of 2/14/2012, my local machine assumes month/day/
> > year and parses it just fine. However, Heroku assumes day/month/year.
> > So, when it is give to parse 2/14/2012 it gives me out of range error.
> > The outputs are below. Any idea why it does this? It is disrupting my
> > time values...
>
> > Heroku Console Output:
>
> >>> Time.zone
> > => (GMT+00:00) UTC
> >>> Time.zone.parse("02/14/2012 03:00 am")
> > ArgumentError: invalid date
> >        /usr/ruby1.9.2/lib/ruby/1.9.1/date.rb:1688:in `new_by_frags'
> >        /usr/ruby1.9.2/lib/ruby/1.9.1/date.rb:1733:in `parse'
> >        /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/
> > active_support/values/time_zone.rb:271:in `rescue in parse'
> >        /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.1.3/lib/
> > active_support/values/time_zone.rb:271:in `parse'
> >>> Time.zone.parse("02/12/2012 03:00 am")
> > => Sun, 02 Dec 2012 03:00:00 UTC +00:00
>
> > My Workstation Output:
>
> > irb(main):008:0> Time.zone
> > => #<ActiveSupport::TimeZone:0xb6bfdc5c
> > @tzinfo=#<TZInfo::TimezoneProxy: Etc/UTC>, @utc_offset=nil,
> > @current_period=nil, @name="UTC"> irb(main):009:0>
> > Time.zone.parse("02/14/2012 03:00 am") => Tue, 14 Feb 2012 03:00:00
> > UTC +00:00 irb(main):010:0> Time.zone.parse("02/12/2012 03:00 am") =>
> > Sun, 12 Feb 2012 03:00:00 UTC +00:00
>
> > --
> > You received this message because you are subscribed to the Google Groups
> "Heroku" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/heroku?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Heroku" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/heroku?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to