Hi,
yday() is method that is defined for object of Time class. But your method
invocation of yday() doesn't seems to be on object of time class.
following should work
require 'date'
positivedate=(Time.now) # Object of time class
day_of_the_year = positivedate.yday() # Invoke method on object of Time
class.
puts "#{day_of_the_year}"
- Angrez
On 5/28/07, Ajitesh Srinetra <[EMAIL PROTECTED]> wrote:
I want to get the day of the year of the any date .
I am using the function yday
The code i am using in my testcase is
require 'date'
positivedate=(Time.now).strftime("%Y/%m/%d")
day_of_the_year = yday( Time.now)
puts "#{day_of_the_year}"
But it is unable to recognise the function yday and throwing error
NoMethodError: undefined method `yday' for main:Object
from (irb):13
I have seen in date.rb the function, yday() is present so no problems
with ruby version
Ajitesh Srinetra
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general