doubt in converting to epoch time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pavanponnapalli
    New Member
    • May 2008
    • 51

    doubt in converting to epoch time

    hi,
    i am using Date::Time and using localtime function to convert a given timestamp to epoch seconds. Everything is fine. The problem comes when we give date someting like 2008-11-31 04:45:45 . The error it is giving is date out of range (0..30). It is not converting date with 31 to its equvivalent epoch seconds.
    How to convert this into epoch seconds? Pls give me a solution.

    Thanks,
    Pavan
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    You've posted recent questions and appear to never return to read the replies:

    About debugging
    Diffrence between timestamps
    Freeing up memory by undefining perl variables

    So I am not inclined to waste my time posting replies anymore.

    Regards,
    Kevin

    Comment

    • pavanponnapalli
      New Member
      • May 2008
      • 51

      #3
      Dear friend,
      I have seen all your replies. I have searched for epoch seconds.
      Used them in my program, but at atlast i have got an error when i entered date as 31. I have surfed through the net, asked my quoleagues to solve my problem. But, i could not get the result. I am sorry if i did make a mistake.
      Pls help me in solvin this problem.

      My problem is:
      Code:
      use Time::Local;
      
      my $a = "2008-04-02 10:23:34";
      my $b = localtime($a);
      It is working fine. only when u give 31 instead of 30 . i am getting out of range error. So, pls help me in this regard.

      Regards,
      Pavan
      Last edited by eWish; Nov 7 '08, 02:32 PM. Reason: Fixed Code Tag

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        Well, considering there is only 30 days in the 11 month........

        Comment

        • pavanponnapalli
          New Member
          • May 2008
          • 51

          #5
          hi, i have added code pls see my reply.

          Regards,
          Pavan

          Comment

          • KevinADC
            Recognized Expert Specialist
            • Jan 2007
            • 4092

            #6
            Originally posted by pavanponnapalli
            hi, i have added code pls see my reply.

            Regards,
            Pavan
            The code you posted:

            Code:
            use Time::Local;
            my $a = "2008-04-02 10:23:34";
            my $b = localtime($a);
            That does nothing. You loaded Time::Local and didn't use any of its functions, and localtime() doesn't take a date as its argument, it takes epoch seconds as its argument. If no argument is supplied it uses time.

            Comment

            • KevinADC
              Recognized Expert Specialist
              • Jan 2007
              • 4092

              #7
              I have added reply, please see my reply. DOH !!!!!!!!

              Comment

              Working...