1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2014
    Rep Power

    Exclamation How do I calculate the beginning of the year on Rub

    I have part of the code of the program but I need to add "at_the_beginning_of_year" method?

    class Fixnum
    def seconds;self; end
    def minutes;self*60; end
    def hours; self*60*60; end
    def days; self*60*60*24; end
    def at__the_beginning_of_year ????


    if compile the below statement

    the output will be:
    2014-01-01 00:00:00 - 0800
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Rep Power

    forget about Ruby for a second and approach this problem with nothing but your brain: Given a timestamp, how do you get to the beginning of the year?
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo