# Problem for created\_at and updated\_at

**URL:** <https://www.ruby-forum.com/t/problem-for-created-at-and-updated-at/179645>\
**Category:** Rails\
**Created:** [December 1, 2009, 6:01am UTC](https://www.ruby-forum.com/t/problem-for-created-at-and-updated-at/179645 "2009-12-01T06:01:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gandhi-tush](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/5daacb/32.png) [@gandhi-tush](https://www.ruby-forum.com/u/gandhi-tush)\
**Post date:** [December 1, 2009, 6:01am UTC](https://www.ruby-forum.com/t/problem-for-created-at-and-updated-at/179645/1 "2009-12-01T06:01:31Z")

</div>

Hi,  
I am using rails 2.3.2. and database postgressql.  
I have created one table with name “courses”.  
In that table I have the field “name, user\_id, created\_at and  
updated\_at”.  
For insertion I am writing code like this:-

Course.create(:name=\>params[:name], :user\_id=\>params[:id])

It is saving the record into database but I have seen that created\_at  
and updated\_at values are ahead of one day.

Can anyone help me out for this?

Thanks,

Tushar

---

<div class="post-metadata">

**Author:** ![gandhi-tush](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/5daacb/32.png) [@gandhi-tush](https://www.ruby-forum.com/u/gandhi-tush)\
**Post date:** [December 1, 2009, 4:55pm UTC](https://www.ruby-forum.com/t/problem-for-created-at-and-updated-at/179645/2 "2009-12-01T16:55:04Z")

</div>

Tushar G. wrote:

> Hi,  
> I am using rails 2.3.2. and database postgressql.  
> I have created one table with name “courses”.  
> In that table I have the field “name, user\_id, created\_at and  
> updated\_at”.  
> For insertion I am writing code like this:-
> 
> Course.create(:name=\>params[:name], :user\_id=\>params[:id])
> 
> It is saving the record into database but I have seen that created\_at  
> and updated\_at values are ahead of one day.
> 
> Can anyone help me out for this?
> 
> Thanks,
> 
> Tushar

Rails fills in these fields automatically, using Time.now, which in turn  
just uses your system time. Are you sure your system clock is set to  
the right date?

I may have misunderstood your question, it wasn’t very clear, if so then  
sorry.
