Displaying 20 results from an estimated 60000 matches similar to: "Is DateTime and Time interchangeable?"
2008 Jun 10
5
Rails params parsing bug?
I have a form that sends the following query string to my Rails
controller:
transaxion[category_association_attributes][][category_id]=2&
transaxion[category_association_attributes][][amount]=12&
transaxion[category_association_attributes][][category_id]=1&
transaxion[category_association_attributes][][amount]=8
But ActionController parses it as:
2011 Dec 10
1
ActiveRecord time and datetime
Hi,
Suppose I have a model class which has a time field:
class CreateAppointments < ActiveRecord::Migration
def change
create_table :appointments do |t|
t.string :name
t.datetime :startTime
t.datetime :endTime
t.string :description
t.timestamps
end
end
end
When I test drive it in rails console, I can input any value int he
startTime and endTime such
2008 Mar 20
4
Blank DateTime versus Nil DateTime
Hi!
These days I have been having trouble with a test that tried to test
DateTime functionality. I have discovered that a NULL DateTime is
auto-type casted to NIL by Rails.
My problem here is that I have a field :datetime and I want to allow
NULL datetimes but not wrong datetimes. With this validation if deadline
is wrong or if is is blank it returns true. How I can accomplish this?
protected
def
2008 Nov 19
3
Mock today
In some of my unit tests, I find the need to set today to a different
value than the actual today. For example, to test the model method
"balance_of_today", which takes no argument, I want to have Date.today
be a specific date for the purpose of testing. In other words, I want
to do something like this:
mock_today(Date.new(2008, 2, 1)) do
... test code...
end
My implementation for
2006 May 18
4
WebServices and DateTime - 3 elements of civil date are necessary
I simply trying to receive an array of objects, retrieved by
ActiveRecord from table with datetime column and I have:
test_list(SoapControllerApiTest):
ArgumentError: 3 elements of civil date are necessary
/usr/lib/ruby/1.8/date.rb:1214:in `new_with_hash''
/usr/lib/ruby/1.8/date.rb:1258:in `parse''
....
It''s a bug or I am wrong somewhere?
2007 Jul 08
2
datetime_select, is creating an instance of the Time class
Hello
It seems that datetime_select, is creating an instance of the Time
class. Why would that be?
I found this while building a site where people can create vigils
(prayer vigils, peace vigils, etc). When I added a validation method
that compared start_date to created_at, it generated the error:
ArgumentError (comparison of Time with DateTime failed):
I was able to put a breakpoint in the
2006 Jan 20
1
XMLRPC::DateTime from AWS
When I do an XMLRPC webservice call to retrieve a single Product, my
DateTime fields in the products table do not get converted to a valid
DateTime value, but remain as XMLRPC::DateTime structures.
So, say my webservice call is:
@product = @aws.get_product(1)
Then my @product object looks like this:
name: My product
last_updated: #<XMLRPC::DateTime:0x37c5338>
description: This is my
2008 Sep 12
1
restful_authentication rspec failures "Mysql::Error: Incorrect datetime value:"
I am getting 193 failures that all have "Mysql::Error: Incorrect
datetime value:"
how do i fix this??? i am new to rspec and restful_auth, so if i am
doing something wrong, let me know!!!
windows xp
rails 2.1.1
rails testproject
cd testproject
# create my databases and edit database.yml
git init
git submodule add git://github.com/dchelimsky/rspec.git vendor/plugins/
rspec
git
2005 Sep 22
1
ActiveRecord DateTime mapping
Hye,
I try to store DateTime as integer (seconds) in my database (MySQL).
I''d like to convert seconds to DateTime in the ActiveRecord object
to handle it easily in my views.
I try to play with callbacks or with method dedicated to my attributes for eg.
def fetched
upd = nil
v =read_attribute(:fetched)
if (v)
upd = DateTime.at(v)
else
upd = DateTime.now
end
end
def
2006 Jul 09
2
serialized DateTime objects returning as Time objects
I have a database field called dates in which I am trying to serialize an
array of DateTime objects. When I unserialize them, they are coming back
in as Time objects. I know this, because I am getting errors that say
"comparison between Time and DateTime failed.
Why is this happening? Is there a way to prevent it??
Thanks Shelby
-------------- next part --------------
An HTML attachment
2006 Oct 19
3
Selecting datetime values from SQL Server (year < 1970)
All,
Rails 1.1.6.
Any AR find() call that generates a SELECT * type query against a table
with a DATETIME column in SQL Server whose value occurs before 1970 will
fail, because of the coercion of SQL Server datetime types to Time
values in Ruby.
See sqlserver_adapter.rb line 490
(record[col] = record[col].to_time if record[col].is_a? DBI::Timestamp)
If I remove the coercion (just commenting
2006 Jan 07
1
datetime returned as string, sometimes....
Hi,
I''m using postgresql 8.1, rails 1.0, and I have a strange problem on a
datetime field (timestamp without time zone in postgresql).
As shown below, the field "value" sometimes returns a string, and
sometimes a Time instance, depending of where the value is used....:
* breakpoint session _from inside an instance method_ of the object:
value
=> "1996-05-01
2006 May 10
3
migrations :timestamp becomes :datetime in mySql
For some reason whenever I try and create a timestamp column with
migrations and mysql I get a datetime column instead. That''s kind of
annoying because I want the column to update every time the row gets
changed. Is this a bug, or is there something I can do about it?
(Obviously I can manually change my mysql table, but that kind of
defeats the point of migrations!)
In my migration
2006 Jul 18
1
Auto-populating time portion of a datetime field from a form
I see that if I use the date_select helper in my view, then in the
generated page, my selects are named obj[datetime_field(1i)] (and 2i and
3i for the other parts). These auto-populate the date portion of my
datetime_field.
I have another datetime field that I''m presenting the time from and I
would like to use a similar scheme to autopopulate it. Currently, I''ve
used the
2012 Apr 17
6
ActiveRecord with different Date/Time format
I have an application where user sets his/her preferred date/time
format. User is expected to enter datetime in his preferred format
across the application. Now the problem is for few formats the datetime
is parsed wrongly while create/update ActiveRecord.
For example user has set date/time format in hh:mm dd/MM/yyyy. Now if
user enters 17:00 04/05/2012 it parses it as 5 PM 5 Apr, 2012 where it
2006 Jan 03
1
find_by datetime question
Hi,
I was wondering if any of you Rails/SQL ninjas knew of an elegant way
to grab from activerecord all the rows that are within an interval of the
current time (say in the last week). For instance, if there''s the
created_on datetime column, is there a zippy way to use find() without SQL?
It seems like the Ruby
DateTime object doesn''t really do intervals for numerous
2006 Apr 07
3
Inline editing of datetime and dropdown select objects?
I don''t believe that Rails has support for the inline editing of
datetime objects or dropdown combo boxes.
Does anyone have a helper function or two that would allow me to do such
a thing?
--
Posted via http://www.ruby-forum.com/.
2006 Dec 15
1
What's up with DATETIME and TIMESTAMP in Asterisk 1.4beta3 ?
Hello,
In Asterisk 1.4 beta 3, the UPGRADE.txt file says:
Variables:
* The builtin variables ${CALLERID}, ${CALLERIDNAME}, ${CALLERIDNUM},
${CALLERANI}, ${DNID}, ${RDNIS}, ${DATETIME}, ${TIMESTAMP},
${ACCOUNTCODE},
and ${LANGUAGE} have all been deprecated in favor of their related
dialplan
functions. You are encouraged to move towards the associated dialplan
function, as these
2001 Apr 09
1
syntax error in datetime.c (PR#901)
Full_Name: Naoki Takebayashi
Version: 1.2.2
OS: Linux, RedHat 7.0/alpha
Submission from: (NULL) (152.3.12.123)
With RedHat 7.0/alpha (gcc 2.96-69), I encountered following error:
gcc -I. -I../../src/include -I../../src/include -I/usr/local/include
-DHAVE_CONFIG_H -mieee -O2 -mieee -c datetime.c -o datetime.o
datetime.c: In function `do_systime':
datetime.c:306: parse error before `ans'
2007 Aug 12
4
Date and Time validator, updater
Can someone point me to a date/time validator or updater.
I have an event start datetime and an event end datetime. I want
to validate that the end datetime is after the start datetime.
Figure there is some code or library out there already, if you
know one, please forward it.
Thank you!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are