def parse_datetime(self, value):
        """A lazy method to parse anything to datetime.
        
        Usage::
        
            >>> from weatherlab.lib.timelib.timewrapper import timewrapper
            >>> from datetime import date
            >>> timewrapper.parse_datetime("2001-09-11 10:07:00 AM")
            datetime.datetime(2001, 9, 11, 10, 7)
            >>> timewrapper.parse_datetime(1000217220.0)
            datetime.datetime(2001, 9, 11, 10, 7)
            >>> timewrapper.parse_datetime(date(2001, 9, 11))
            datetime.datetime(2001, 9, 11, 0, 0)
        """
        if isinstance(value, datetime):
            return value
        elif isinstance(value, str):
            return self.str2datetime(value)
        elif isinstance(value, int):
            return self.fromtimestamp(value)
        elif isinstance(value, float):
            return self.fromtimestamp(value)
        elif isinstance(value, date):
            return datetime(value.year, value.month, value.day)
        else:
            raise Exception("Unable to parse datetime from: %s, type<%s>." % (
                            value, type(value)))
def parse_datetime ( self , value ) : if isinstance ( value , datetime ) : return value elif isinstance ( value , str ) : return self . str2datetime ( value ) elif isinstance ( value , int ) : return self . fromtimestamp ( value ) elif isinstance ( value , float ) : return self . fromtimestamp ( value ) elif isinstance ( value , date ) : return datetime ( value . year , value . month , value . day ) else : raise Exception ( "Unable to parse datetime from: %s, type<%s>." % ( value , type ( value ) ) )
A lazy method to parse anything to datetime.
        
        Usage::
        
            >>> from weatherlab.lib.timelib.timewrapper import timewrapper
            >>> from datetime import date
            >>> timewrapper.parse_datetime("2001-09-11 10:07:00 AM")
            datetime.datetime(2001, 9, 11, 10, 7)
            >>> timewrapper.parse_datetime(1000217220.0)
            datetime.datetime(2001, 9, 11, 10, 7)
            >>> timewrapper.parse_datetime(date(2001, 9, 11))
            datetime.datetime(2001, 9, 11, 0, 0)