similar to: Date verus Time class

Displaying 20 results from an estimated 2000 matches similar to: "Date verus Time class"

2006 Jan 22
8
Date Calculation
I am trying to calculate the number of days between 2 dates using Time.now - object.date where object.date is a date pulled from a database. I want to display the age of the entry in the database in days. I keep getting an error about not being able to convert a date into a float. What am I doing wrong. If I use object.date - object.date it seems to work but the answer is useless (0). I
2009 Jun 18
3
Date.new.to_time.to_i
What''s going on here!? >> Date.new.to_time.to_i NoMethodError: undefined method `to_i'' for Mon, 01 Jan -4712 00:00:00 -0800:DateTime from (irb):25 >> Date.today.to_time.to_i => 1245308400 >> RUBY_VERSION => "1.8.7" >> Rails.version => "2.1.1" (I''m not sure if this is a rails thing, or just a ruby thing) --
2006 Mar 01
3
Convert Date to Time
Hi, How do i convert a Date to a Time?? I have a date returned from sql and i need to be able to use handy functions like next_week or beggining of week. Any help appreciated Thanks, Chris -- Posted via http://www.ruby-forum.com/.
2008 May 03
11
Date comparisons
I occasionally get this error: 1) ''A puzzle once featured, should no longer be nominated'' FAILED expected: Sun May 04 09:10:26 -0700 2008, got: Sun May 04 09:10:26 -0700 2008 (using ==) ./spec/models/puzzle_spec.rb:180: So, the dates looks the same to me. Any ideas for how to debug? Joe
2006 Apr 08
5
What is the h for?
In the "Agile Web Development with Rails" book it runs through making an example application, a shopping cart. In one of the views files, there is one line of code I dont understand (below), I dont know what the "h" is for, also I took the h out, and it did not affect the application (as far as i could see). <%= h(product.title) %> Can anyone shed some light on this
2015 Dec 04
0
FC22 verus FC23
I have a quad display set up. It is working perfectly under FC22, but bombs on FC23. I wish I had more information for you, but I had to get this machine back up and running. Not only does the quad head not work, the one working head was operating at 1280x1024 versus 1920x1080. I tried doing a fresh install of FC23 and an upgrade from FC22 to FC23. It did not work in either situation. So, I
2008 Jun 08
20
how to parse a "dd/mm/yyyy" formatted date string???
Hi, I''m stuck. How do you parse a "dd/mm/yyyy" formatted date string??? I get a date format error. Thanks in advance Greg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2006 Jan 16
8
[newbie] This Month / Next Month / The One After That
What I want to do is simple. I''d like code that prints out the name of this month (January) the next month (February) and the one after that (March) I''ve been able to print this month: <% t = Time.now %> <%= t.strftime(" This Month is: %B") %> But I can''t figure out how to get the next months to print out! -- Posted via
2006 Mar 31
6
Calculating Dates
Hello, I am a complete newbie with Ruby and Rails. I am working on learning it by writing a project I was going to write in PHP using Rails. I am having a difficult time finding clear information on how I would do this. I need to take a date out of a table in my database and given another day calculate the next 28 day anniversery of the original date. This is used to calculate a delivery
2007 Feb 20
4
Best way to implement syntax sugar?
Hi! I''m *very* new to rails, I just dove in about a month ago and I''m loving it. One thing I decided I immediately wanted to do, was shorten the number of keystrokes neccessary to URI, HTML, or Jscript encode something. The project I''ve come into already has helpers defined for this. Right now, what I''ve done is: alias h! string_esacpe_html alias u!
2005 Mar 09
21
Converting time retrieved from MySQL
I''m having a problem converting a date retrieved from my MySQL database and I''m hoping someone can help. MySQL stores the date/time as this: 2005-03-08 17:00:34.0 and according to my Pickaxe book Ruby stores times as "the number of seconds and microseconds since [...] January 1, 1970". All well and good. Unfortunately, RoR is converting my date to this:
2007 Nov 15
2
Story adapter and SQLite Was:What command to run all stories?
Hi, by switching to MySQL from SQLite, it fixed the problem. I ran rdebug on it and it is trying to call I ActiveRecord::Base.connection.begin_db_transaction. from ActiveRecordSafetyListener.scenario_started. I don''t think SQLLite likes transactions. Ed On Nov 15, 2007 10:56 AM, Ed Howland <ed.howland at gmail.com> wrote: > If I run the story stand-alone, I get: > ruby
2006 Dec 07
2
backgrounDRb problems with results and MiddleMan
Hi there, I''ve been experimenting with implementing BackgroundDRb in my rails app but am running into some problems. The primary problem I''m getting is in cleaning up worker threads, or getting any kind of response out of worker threads. If try using the response function/hash in my Worker the worker will not execute reporting that response is an unknown variable or function.
2007 May 10
2
Problem with translator
Hi, Just installed 0.9.4 (from 0.8 series) and ran the spec translator. It messed up specs that had the should include() where the argument to include is a string (using no parens for the arg) IOW, given: context "OldSchool" do class OldSchool attr_accessor collection def initialize @collection = [] end def add_new(item)
2007 Sep 24
3
Oracle Date + RoR
Hi Experts, I''ve a model called Product where i''ve column called created_at, updated_at where i''ve made a query based on Oracle date format like date_of_created = ''23-SEP-07'' @product = Product.find(:all, :conditions => ["created_at=?", date_of_created]) but in view its empty. AND EXPERTS I''VE DATA WITH 24-SEP-07 FOR MORE
2006 Feb 03
2
acts_as_tree counter_cache behavior is different than API docs
Before I file a ticket, I''ll query ya''ll about this: The API docs for acts_as_tree''s counter_cache is to create a database column called "children_count" to hold the counter_cache. I have enabled this option in my model. While writing tests I wrote a test for creating children from the a parent: message = @forum_message["parent"].find child =
2008 Jun 02
2
get method under 1.1.4 in Stories is undefined
HI, After I upgraded to RSpec 1.1.4 (from git), my stories all failed. I was using Webrat and the first thing I noticed was the ''visits'' method was gone. I then backtracked to just using ''get'' and got the same undefined method exception. I confirmed it was still working in 1.1.3 Eventually, I got it to work doing this: in my first Given: @app =
2006 Jul 26
4
MasterView rails-optimize (x)html friendly template engine - Release 0.2.4
MasterView is a rails-optimized (x)html friendly template engine plugin that provides another option to the existing rails view templates (rhtml and rxml). The main idea is to provide a template engine that would provide all the power of layouts, partials, and rails helpers but still be editable/styleable in a WYSIWYG editor. It was also a major goal that the syntax of these attribute directives
2006 Mar 16
2
Arrays of Model Objects, Intersections, Object Identification... ?
Hi all, Hope you can help me with understanding how Ruby / Rails treats arrays full of objects. Let''s say I have to arrays of objects. Both are the same kinds of objects. tomatoes = Fruit.find(:all, :conditions => [ ''tomato = ?'', true], :limit => 10) fruits = Fruit.find(:all, :limit => 10) And I want to create an array of these objects called @my_fruits,
2006 Jul 25
9
Can anyone explain this code? It uses Inject
def webs @webs ||= Web.find(:all).inject({}) { |webs, web| webs.merge(web.address => web) } end -- Posted via http://www.ruby-forum.com/.