Displaying 20 results from an estimated 1000 matches similar to: "Convert Date to Time"
2006 Apr 25
1
Array of dates/times from time.now till nextweek
Hi,
I would like to make @dates in my controller.
I tried the following:
startdate = Time.now
enddate = startdate.next_week
for enddate > startdate
@dates << startdate
startdate = startdate.tomorrow
end
But I get an errormessage when I check the syntax:
"warning: useless use of a variable in void context"
Anyone?
Thanks!
Steven.
--
Posted via
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 May 11
4
string to date/time?
Hey All,
Anyone know of a library for parsing "human" dates, like "this friday"
or "2 days ago"? I used to use strtotime in php, but starting from
here;
http://wiki.rubyonrails.com/rails/pages/PhpStrtotime
and doing lots of googling, I haven''t been able to find anything
similar for ruby. I know of javascript solutions to this, but I''d
need to do
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
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:
2006 Oct 24
13
How can my boss take rails seriously with bugs like this?
The Time::next_week method is supposed to give the time of the start of
the next week. But look at this, it cocks up :
>> t=Time.parse "Monday October 16th 2006"
=> Mon Oct 16 00:00:00 BST 2006
>> t.next_week
=> Mon Oct 23 00:00:00 BST 2006
>> t.next_week.next_week
=> Tue Oct 24 00:00:00 BST 2006
>> t.next_week.next_week.next_week
=> Mon Oct 30
2006 Jul 05
1
time.next_week bug?
i ran into an error today when dealing with the method next_week and
daylight savings time...
>> Time.local( 2006,10,23 ).next_week
=> Tue Oct 24 00:00:00 EDT 2006
Any one know if this is a know issue or should a ticket be created for this
issue?
thanks for the help
mark
--
Mark Van Holstyn
mvette13@gmail.com
http://lotswholetime.com
-------------- next part --------------
An HTML
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
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
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 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
2008 Jun 28
14
Date Field convert to Seconds since Epoch
Hi, I was wandering if anyone could help me with this problem:
Right now I am using a field in my database which is of type
''Date'' (in the form dd-mm-yyyy). I would like to convert this value
(for example 26-06-08) into a number of seconds since epoch or into
another form so I can compare it with todays date (from Date.now) so
that I can tell the difference between the two dates
2005 Jan 01
1
Re: vpim: bug in icalendar.rb, Icalendar#decode_status
Thanks for the bug report!
I''ll get a new release out next week, I''ve been on vacation for a few
weeks and I''m just getting up to speed with being back in a city.
In the meantime, the fix is to apply the following patch (in
Icalendar.decode_duration). I''ve also integrated your tests, thanks.
Cheers,
Sam
diff -u -r1.22 icalendar.rb
--- vpim/icalendar.rb 17
2006 Apr 04
11
Date/Time format and syntax
Hi,
Just wondering how I get both the current date and time to display here
(so far I can only get the date OR the time):
@tblregisteredphone.txtregisterdatetime = Date.today
Also, how can I change the format of the date and time from:
Tue Apr 04 00:00:00 GMT Daylight Time 2006
to
2006-04-04 12:04:00
??
I''m sure it''s very simple, I just don''t know how
2006 Feb 09
17
complicated finds are eating my sole
I abandoned ruby way for find_by_sql and still can''t get this...
@myplacement = Placement.find_by_sql(
"select * from placement where
:intake_date >= beg_intake_date
and
:intake_date <= end_intake_date")
just a simple date range...it''s killing me - If I knew how to load
placement controller into irb, I could probably try out finds
interactive mode...
Thanks
2005 Dec 12
1
Search screens with dates
Tried googling and searching the lists for this. I''d like to do a
search on some dates and naturally enough use the date helpers. I
have a number of problems:
-- datetime_select wants an active record model
-- select_datetime does not take the options that datetime_select
take - specifically :order
that leaves me with something like
<label>Date/Time
2006 Aug 10
3
Ruby on Rails with Oracle
Hello everyone,
I am trying to convince my colleagues to convert to Ruby on Rails,
however I am up against the following problem:
Ruby on rails seems to be primarily designed a single database doing a
small number of queries. While trying to process a webpage that does
thousands of sql queries on Oracle, I get the message that I have used
up too many cursors.
In Java, I can use stmt.close()
2006 May 21
3
Using ParseDate in for loop
Hi,
I''m trying to use ParseDate within a for loop but I get this error:
can''t dup NilClass
Any suggestions for making this work?
Thanks,
-Jason
2006 Jun 05
3
How to get dd mmm and yyyy from dd-mmm-yyyy
The input values could be something like this:
01-Dec-2006
01-December-2006
1-June-2006
Is there an easy to way to get the three variables populated dd, mmm and
yyyy for any of the above input values? I tried to look at regex but couldn''
anything simple.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
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)
--