# MySQL Datetime Format confusion

**URL:** <https://www.ruby-forum.com/t/mysql-datetime-format-confusion/61861>\
**Category:** Rails\
**Created:** [May 29, 2006, 2:38am UTC](https://www.ruby-forum.com/t/mysql-datetime-format-confusion/61861 "2006-05-29T02:38:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JesterXL](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b38774/32.png) [@JesterXL](https://www.ruby-forum.com/u/JesterXL)\
**Post date:** [May 29, 2006, 2:38am UTC](https://www.ruby-forum.com/t/mysql-datetime-format-confusion/61861/1 "2006-05-29T02:38:49Z")

</div>

I have a column in a mysql table called “start\_date” as a datetime. I’m  
returning the results from that table as XML.

render :xml =\> @mystuff.to\_xml

However, instead of coming across like:

2006-05-28 00:00:00

It comes across in the XML instead as:

2006-05-28T02:00:00-04:00

Is there a way to make it match the mysql format, or another way to have  
it  
generate XML so the string matches the way mysql shows it? Otherwise, I  
can  
parse the way Rails is sending it back, just curious why the format is  
different.

???

–JesterXL

---

<div class="post-metadata">

**Author:** ![JesterXL](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b38774/32.png) [@JesterXL](https://www.ruby-forum.com/u/JesterXL)\
**Post date:** [May 29, 2006, 2:51am UTC](https://www.ruby-forum.com/t/mysql-datetime-format-confusion/61861/2 "2006-05-29T02:51:07Z")

</div>

Hi !

2006/5/28, JesterXL [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 2006-05-28 00:00:00
> 
> It comes across in the XML instead as:
> 
> 2006-05-28T02:00:00-04:00

This is the XML Schema date/time format:  
[http://www.w3.org/TR/xmlschema-2/#dateTime](http://www.w3.org/TR/xmlschema-2/#dateTime)

Hope that helps !
