Forum: Ruby on Rails to_json problem (Rails2.2.2)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ea44bd120ed7cf301d561bcc3e7a6c96?d=identicon&s=25 浩翔 (Guest)
on 2009-02-23 09:04
(Received via mailing list)
Hi  all,

    i got a record from my project server side  database, like this :

        @user = User.find 1
   then  i  cover @user to json format:
        @user.to_json

   the result :
       "created_at": "2009-01-28T12:29:32Z"

   what's the  T and Z of  created_at field ?


   but  i change Rails 2.2.2 to Rails1.1.6,

   I got :
       "created_at": "2009-01-28 12:29:32"

   this is a bug of the Rails2.2.2   ???
Ea44bd120ed7cf301d561bcc3e7a6c96?d=identicon&s=25 浩翔 (Guest)
on 2009-02-23 09:08
(Received via mailing list)
Time Zone ?

how to delete T && Z ?
Ce71159849bf8a9bb16d34824e0a0eeb?d=identicon&s=25 David Nugent (Guest)
on 2009-02-23 10:23
(Received via mailing list)
On 23/02/2009, at 7:02 PM,  wrote:

>       "created_at": "2009-01-28T12:29:32Z"
>
>   what's the  T and Z of  created_at field ?

See RFC3339.


>   but  i change Rails 2.2.2 to Rails1.1.6,
>
>   I got :
>       "created_at": "2009-01-28 12:29:32"
>
>   this is a bug of the Rails2.2.2   ???


I would call it an improvement. "Z" means UTC, but you can convert to
and use other timezones if you wish. The old way gives no clue as to
timezone and is therefore incomplete.


/d
This topic is locked and can not be replied to.