similar to: How to subtract months from time?

Displaying 20 results from an estimated 5000 matches similar to: "How to subtract months from time?"

2007 Dec 12
6
Add a month to a Date object
Howdy all, This may be the dumbest question in the world, but how can you "add one month" to a Date object? I can''t just add 30 days, because months have varying lengths. Any help would be much appreciated... Thanks! -Neal --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails:
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 >>
2006 Jan 22
23
calculate users age
i know it''s probably really simple, how do i work out someone''s age if i have their d.o.b. stored as a date in my db. cheers -- Posted via http://www.ruby-forum.com/.
2006 May 16
10
Date verus Time class
I''m using the date_select and datetime_select helpers in my view, and they return Date classes from the params hash. But how do I work with Date classes, they don''t print human readable dates or times, Time classes work well I can use strftime("%H:%M") to print to the screen. Is it possible to convert a Date to a Time, Ive been tinkering in irb but have got
2006 Apr 23
37
Newbie .. nil object and missing something obvious
Trying to do first project in Ruby on Rails, and I''m getting the dreaded nil object exception. I''ve reduced the code to what I think is the minimal case, and it''s still not working. Code presented below.. ---------------------------------------------------------------------- in "app/controllers/dashboard_controller.rb" class DashboardController <
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
2006 Jan 17
4
find_by_sql column ordering defect?
Hello. I have a program that accesses a metadata (translation) table for column names as well as the ordering of columns for a specific model. Also in there is a collection of bool options such as column_visible_on_form, column_visible_on_screen_quicklist etc. The idea is that our customer can specify to a certain extent how their layout/user interface will appear. To accomplish this, I use
2019 Jul 03
3
optimisation issue in an llvm IR pass
Hi Craig, On 03.07.19 17:33, Craig Topper wrote: > Don't the CreateICmp calls return a Value* with an i1 type? But then > they are added to an i8 type? Not sure that works.  I had that initially: auto cf = IRB.CreateICmpULT(Incr, ConstantInt::get(Int8Ty, 1)); auto carry = IRB.CreateZExt(cf, Int8Ty); Incr = IRB.CreateAdd(Incr, carry); it makes no difference to the generated assembly
2019 Jul 03
2
optimisation issue in an llvm IR pass
Hello, I have an optimisation issue in an llvm IR pass - the issue being that unnecessary instructions are generated in the final assembly (with -O3). I want to create the following assembly snippet: mov dl,BYTE PTR [rsi+rdi*1] add dl,0x1 adc dl,0x0 mov BYTE PTR [rsi+rdi*1],dl however what is created is (variant #1): mov dl,BYTE PTR [rsi+rdx*1] add dl,0x1 cmp
2007 Sep 25
2
Bug in win32-api with void prototypes?
Hi all, It seems that a void prototype requires an explicit argument in our version of win32/api: C:\>irb irb(main):001:0> require ''win32/api'' => true irb(main):002:0> include Win32 => Object irb(main):003:0> require ''Win32API'' => true # Our version irb(main):004:0> GetLastErrorA = API.new(''GetLastError'',
2006 Feb 07
11
breaking down a list view
I''m trying to figure out how to change the order of a list view and it''s obvious to me that I don''t understand what I get from a simple scaffold to know enough to alter it. If someone would be so kind to tell me what this means ... def list @placment_pages, @placements = paginate :placements, :per_page => 10 end @placement_pages, # I am guessing that this
2013 Jun 21
7
IRB help
I''m new to Ruby. I installed Rails on Windows 8. When I type mkdir in IRB, I''m getting this. I tried running the IRB as administrator too, and still get the same result irb(main):001:0> mkdir lesson2 NameError: undefined local variable or method `lesson2'' for main:Object from (irb):1 from C:/RailsInstaller/Ruby1.9.3/bin/irb:12:in
2005 Dec 12
9
Webrick is being stupid...no info on a brand new project
I created a project, made a migration, generated scaffolding...start up webrick and I get nothing. To simplify things, I just started another project and generated a controller, still getting nothing. The index page loads fine, but nothing beyond that. If I go to anything that should give me a 404, the page is just blank. The Webrick console just says a 500 (nothing explaining why), and
2006 Feb 23
6
irb with rails
I was trying to access rails functions (number_with_precision) from an irb session. It can''t find the method. How do I load the libraries ? TIA LS -- Posted via http://www.ruby-forum.com/.
2006 Mar 09
15
regular expressions slay me
I am furiously trying to find what I am looking for in Pickaxe book and not finding it. I''m getting some values back from a posted form and I need to get the ''id'' number off the backend. The ''String'' will always come back to me as... Some_name\r\n123 where 123 is actually the id number which I need to execute the find. The reason they are coming back
2009 Aug 13
2
if_indextoname on Windows?
Hi all, Windows Vista Home Premium VC++ 9 According to MSDN, the if_indextoname() function should be included on Vista: http://msdn.microsoft.com/en-us/library/bb408408%28VS.85%29.aspx However, I can''t get mkmf to see it. I tried all of these: require ''mkmf'' if have_header(''netioapi.h'') # yes have_func(''if_indextoname'',
2007 Sep 05
6
Caveman Questions
Hello! I''m just a caveman with some caveman questions. I''ve been parsing Rspec for quite a while, and I''m writing my first series of specs. My initial impressions are "Verbose, but understandable. Helpful and intuitive, but so much to digest." I want to congratulate the folks who are dedicating a chunk of their lives to writing this, and ask 2 caveman
2006 Mar 28
5
Anyone use .uniq! ???
could anyone by chance give me a working example of the .uniq! method? i''ve been trying all day. any help would be much appreciated! jon -- Posted via http://www.ruby-forum.com/.
2006 Jun 09
18
Is IRB the ruby console ?
I''m running script/console but keep getting the message that irb.bat is not recognized as an internal or external command, operable program or batch file. If it means anything I am running instant rails. I can invoke irb straight forward. TIA Stuart -------------- next part -------------- An HTML attachment was scrubbed... URL:
2006 May 12
5
Is there a method for incrementing string names?!?
Hello, I have model which has a property named "name", I want to append a number to the end of the name when there is similar name in db. name, name1, name2... Is there a ready to use method in ruby and/or rails for doing so? Thanks in advance, - Dunnil