Displaying 20 results from an estimated 2000 matches similar to: "how to parse a "dd/mm/yyyy" formatted date string???"
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/.
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 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
2009 Dec 30
9
Oracle adapter problem? How to fix this?
Hi,
My setup is:
Ruby 1.8.6
Rails 2.3.5
activerecord-oracle-adapter (1.0.0.9250)
I upgraded Rails and the adapter recently and I just went through hell
trying to find a problem while inserting a record in a table.
Rails was giving me this error:
OCIError (ORA-02289: sequence does not exist):
stmt.c:539:in oci8lib.so
c:/ruby/lib/ruby/site_ruby/1.8/oci8.rb:753:in `exec''
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
2011 Feb 04
5
Date parse - month and day reversed
I am getting the month and day reversed in parsing a date. I am wondering if
there is some intelligence in Ruby that knows that at the moment I am in
Mexico, as the parsing is working as if I was
"6/15/2008".to_date
=> ArgumentError: invalid date
"15/6/2008".to_date
=> Sun, 15 Jun 2008
What I really want is my date to be understood as month/day/year. Is there a
way to
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
2009 Feb 22
6
CHECK if param exists? please help
hi folks.
i want to check if a param exists if not to set it to a default value
for my date range filter. in my controller i have:
@from_date = Date.strptime(params[:startdate],"%d/%m/%Y")
@to_date = Date.strptime(params[:enddate],"%d/%m/%Y")
@articles = @results.find(:all,
:conditions => [ "created_at >= ? and
created_at
2007 Nov 02
3
Date Issues + Oracle + RoR
Hi Experts
I''ve a product like this
ID -> 1
Name -> Xyz
Price -> 30
Created_at -> 02-NOV-07
from_date = Date.new(2, 10, 07)
to_date = Date.new(2, 10, 07)
@product = Product.find_by_sql("select * from products where
created_at between from_date and to_date")
code works perfectly, buy my issue is i dont get any data. always says
no record found
but if i use
2006 Jun 14
5
display formatted date
Hi,
In my form I have date field set as ''datetime_select'' which is fine as I
wanted it in the same format. But while displaying (list action) it
displays date in long format i.e. ''Tue May 30 15:39:00 Central Daylight
Time 2006''. How can I format it so that it will just be diaplyed as
''dd/mm/yyyy'' format?
Thanks
--
Posted via
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
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
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
2009 Sep 14
9
ActiveRecord::StatementInvalid (invalid date) with Oracle
Hello all. I am a novice Ruby on Rails programmer, starting my first
project using a legacy Oracle 10 database. Using ''reverse_scaffold'' I
have created the models/controllers/views for my existing Oracle
tables.
All seems to work well, using /model/index, /model/show for most of my
tables, *except* when one of the tables contains a Oracle ''date''
column, for
2005 Apr 22
2
help with POSIX
For the r script below
>datestr <- "01/01/2004"
>as.POSIXct(as.Date(datestr, "%d/%m/%Y"))
I get the following output
"2003-12-31 18:00:00 Central Standard Time"
Why is the date a day before. I guess its something to do with the time, but is there a way to get it to return 2004-01-01 instead?
Thanks in advance...
-Sandeep
[[alternative HTML version
2004 Mar 10
2
Inserting Date Field into Oracle table using ROracle
Hello,
Attached is a mail regarding question how to insert Date field using ROracle
package. I am stuck with this problem and appreciate receiving help from
gurus on this list.
Code used mainly is:
library(ROracle) ### --- Version 0.53
drv <- dbDriver("Oracle")
con <- dbConnect( drv, "user/passwd")
d <- data.frame(CDATE = "2004-03-10 10:12:00")
ps
2007 Oct 16
1
try / tryCatch for download.file( ) within a for loop when URL does not exist
I am trying to download a bunch of files from a server, for which I am
using download.file( ) within a for loop. The script is working fine
except until download.file hits a URL which has no file, at which
point it exits. I want to change this behavior to simple log the
failure and maintain state within the for loop and iterate to next. I
read about try / tryCatch but am having trouble