# Need help for formating timestamp on round trip: db -\> browser -\> db

**URL:** <https://www.ruby-forum.com/t/need-help-for-formating-timestamp-on-round-trip-db-browser-db/209288>\
**Category:** Rails\
**Created:** [July 10, 2011, 7:58pm UTC](https://www.ruby-forum.com/t/need-help-for-formating-timestamp-on-round-trip-db-browser-db/209288 "2011-07-10T19:58:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [July 10, 2011, 7:58pm UTC](https://www.ruby-forum.com/t/need-help-for-formating-timestamp-on-round-trip-db-browser-db/209288/1 "2011-07-10T19:58:51Z")

</div>

I have a date in the sqlite3 database which gives me trouble

sqlite\> select \* from accounts;  
3|myname|2011-07-10 13:47:26.055000|2011-07-10 13:47:26.055000

putting it into html via the hidden\_field.tag like this

```
<%= f.hidden_field :updated_at %>

```

here f comes from

```
<%= form_for(@account) do |f| %>

```

that produces working html code as such

```
<input id="account_updated_at" name="account[updated_at]"

```

type=“hidden” value=“2011-07-10 13:47:26.055000” /\>

now I need to add the very some date as query parameter to an url of a  
link and following code works most of the time but NOT with that  
example from the database:

\<%= link\_to ‘Destroy’, account\_path(account) + “?  
account[updated\_at]=#{account.updated\_at.utc.strftime(‘%Y-%m-%d %H:%M:  
%S.%N’)}”, :confirm =\> ‘Are you sure?’, :method =\> :delete %\>

which produces

[Destroy\</  
a\>](https://www.ruby-forum.com/accounts/3?account[updated_at]=2011-07-10%2013:47:26.550)

[ 

this query-parameter parses into a different date then the one I have  
in the database - so I can not find the model in the database.

 

background is an optimistic persistence with the help of this  
timestamp since I like to keep the model slim and the activerecord  
default would add another “version” column to it.

 

bug ? or how does this hidden\_field method does it right ? I was not  
able to find the right spot in the code.

 

thanx in advance. Kristian

](https://www.ruby-forum.com/accounts/3?account[updated_at]=2011-07-10%2013:47:26.550)
