# To\_json problem (Rails2.2.2)

**URL:** <https://www.ruby-forum.com/t/to-json-problem-rails2-2-2/161079>\
**Category:** Rails\
**Created:** [February 23, 2009, 9:04am UTC](https://www.ruby-forum.com/t/to-json-problem-rails2-2-2/161079 "2009-02-23T09:04:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSSB9SfFSSB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@SSSB9SfFSSB](https://www.ruby-forum.com/u/SSSB9SfFSSB)\
**Post date:** [February 23, 2009, 9:04am UTC](https://www.ruby-forum.com/t/to-json-problem-rails2-2-2/161079/1 "2009-02-23T09:04:16Z")

</div>

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 ???

---

<div class="post-metadata">

**Author:** ![SSSB9SfFSSB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@SSSB9SfFSSB](https://www.ruby-forum.com/u/SSSB9SfFSSB)\
**Post date:** [February 23, 2009, 9:08am UTC](https://www.ruby-forum.com/t/to-json-problem-rails2-2-2/161079/2 "2009-02-23T09:08:22Z")

</div>

Time Zone ?

how to delete T && Z ?

---

<div class="post-metadata">

**Author:** ![SSSB9SfFSSB](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@SSSB9SfFSSB](https://www.ruby-forum.com/u/SSSB9SfFSSB)\
**Post date:** [February 23, 2009, 10:23am UTC](https://www.ruby-forum.com/t/to-json-problem-rails2-2-2/161079/3 "2009-02-23T10:23:28Z")

</div>

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
