similar to: Add a month to a Date object

Displaying 20 results from an estimated 3000 matches similar to: "Add a month to a Date object"

2006 Oct 22
12
How to subtract months from time?
Hi there, Im reading a date out of a database and I need to subtract exactly 1 month from that date? It needs to be bullet proof so that if the date says 31 and the previous month only has 28 days it wont just subtract 1 from the month and make an illegal date. Thanks Petr -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this
2008 Mar 07
3
timestamp help
I am trying to figure out if a time stamp in my database is older then a month so that way my controller will only collect the one''s that are newer. So far I have @notes = @customer.notes.find(:all, :conditions => {:level => [''notice'', ''warning'', ''error'']}, :order => ''created_at DESC'') But I do not want it
2007 Feb 21
2
date helper bug?
I''ve found an issue when trying to use the time_ago_in_words and distance_of_time_in_words from action view''s date_helper.rb Using SQL Server, I have a datetime column that gets returned as: "2007/02/21 09:54:00". When I pass this to time_ago_in_words (which just passes on to distance_of_time_in_words) it miscalculates the difference as "9 hours" (...um yeah,
2009 Feb 04
4
Rails 2.2.2 to_date and to_datetime methods
In the console I see this behaviour: >> "19270412000000".to_date.methods => ["ns?", "mon", "ago", "end_of_month", "months_since", "default_inspect", "minus_without_duration", ... >> "19270412000000".to_date.class => Date >> "19270412000000".class => String >>
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 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
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 Nov 17
7
super global dummy method for gettext + rails 2.2
Hi, since rails 2.2 doesn''t work with gettext anymore I decided to use a gettext dummy method until the gettext team relases a working version for rails 2.2. My application doesn''t need any i18n support right now and this way i figured it would be very easy to integrate gettext later. Just setup the plugin and go. So I need a method called _ which is available in alle models,
2006 Jul 28
4
add one month or one year to a date
Hi, I need to be able to add one month or in some cases on eyear to a Date. Does anyone know of any easy ways of doing this? thanks scott -- Posted via http://www.ruby-forum.com/.
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
2007 Mar 13
6
Easy Date question - newb
All I want to do is find the objects that were created today under the ''created_on'' column. I''ve tried many ways, here is one example using the chronic gem. @products = Product.find_all_by_created_on(Chronic.parse(''today'')) I must be missing something right in front of me .... Thanks for any help.
2007 Oct 19
14
Agile Web Development Book, need a bit of help
I''m working my way through the book Agile Web Development with Rails, and I am in the section where the book has me creating a display_cart method and the associated view. When I copied the code from the book into the view, it threw this error. If anyone could give me some hints where I should be looking I''d appreciate it. NoMethodError in Store#display_cart Showing
2010 Jan 31
6
Action path - syntax error, unexpected tIDENTIFIER, expecting ')'
I have a user controller with login as action. When I access the index.html.erb file via application.layout file. I get a error on the login link on the index.html.erb page. I think I am having dfifficulty in setting up path to an action or even understanding how to set REST path properly. Can someone please help me. Here is the error on the home page:
2009 Oct 13
3
Site map
Hi All... I am using generate_sitemap plugin to generate sitemap. It goes very well and creates sitemap as well. My problem is I want some links that are coming from vender/plugins. Can any one tell me how to get those links??? Thanks all... -- Posted via http://www.ruby-forum.com/.
2006 Jun 12
3
compare Date with TIme
Hi When returning data from a database column set as a date field I get ''2006-06-06'' I am then have these two lines of code in my controller, taht gain the date I require. pNow = Time.now @pDate = Time.local(pNow.year, pNow.month, 1) At the monment one is set to a date data type while one is set to a Time data type. how can i change these to be the same data type so i can
2009 Jun 07
6
Missing Template when testing with the Brain Buster Captcha partial
When I run my functional tests, they throw an error with the following message: ActionView::TemplateError: Missing template /_captcha.erb in view path app/views:test/vendor/plugins/brain_buster/views/brain_busters On line #23 of app/views/contacts/_form.html.erb 20: <%= f.label :message %><br /> 21: <%= f.text_area :message %> 22:
2008 Aug 26
5
undefined method
I''m trying to pass a method to another object/method as a variable. Example one, login 1 works just fine. def login1 @driver.Login(username, password) end However, if I try to pass "Login" to the driver as an argument (example two Login 2), I get "undefined method `command_string'' for #<SOAP::RPC::Driver:0x316dc28>" "Login" is a legit
2006 Jun 13
17
reconstituting a date
In my view code, I have <%= datetime_select "in_out", "time_in" %> which returns in params :in_out: !map:HashWithIndifferentAccess time_in(1i): "2006" time_in(2i): "6" time_in(3i): "12" time_in(4i): "20" time_in(5i): "24" and I want to save that datetime to a column in the db... if
2007 Feb 27
14
Stop browser from "form filling" fields.
Hi all, I have a user login form which the browser keeps populating because of its form fill feature. So when anyone goes to log in it shows the previous login''s username and password. How can I stop the browser from populating a text field? Thanks in advance. Cheers, Diego --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to
2007 Nov 12
7
schema_info always wants to be 3, even when set to 7
Hi all, I''m having a very odd problem with db:migrate. I''m using Rails 1.2.5 on Windows XP SP2 and Ruby 1.8.6 I have seven migrations. If I run them with an empty database, it runs the first three, then halts. When I look in schema_info, the version is 3. If I run db:migrate VERSION=7, then it runs through the remaining 4 migrations, and the version is 7 in the DB.