Exemplo n.º 1
0
    def todate(self):
        """
        Calculates the corresponding day in the gregorian calendar. this is the main use case of this library.

        :return: Corresponding date in gregorian calendar.
        :rtype: :py:class:`datetime.date`
        """
        arr = get_gregorian_date_from_julian_day(self.tojulianday())
        return datetime.date(int(arr[0]), int(arr[1]), int(arr[2]))
    def todatetime(self):
        """
        Converts the current instance to the python builtins :py:class:`datetime.datetime` instance.

        :return: the new :py:class:`datetime.datetime` instance representing the current date and time in gregorian calendar.
        :rtype: :py:class:`datetime.datetime`
        """
        arr = get_gregorian_date_from_julian_day(self.tojulianday())
        return datetime(int(arr[0]), int(arr[1]), int(arr[2]), self.hour, self.minute, self.second, self.microsecond,
                        self.tzinfo)
Exemplo n.º 3
0
    def todatetime(self):
        """
        Converts the current instance to the python builtins :py:class:`datetime.datetime` instance.

        :return: the new :py:class:`datetime.datetime` instance representing the current date and time in gregorian calendar.
        :rtype: :py:class:`datetime.datetime`
        """
        arr = get_gregorian_date_from_julian_day(self.tojulianday())
        return datetime(int(arr[0]), int(arr[1]), int(arr[2]), self.hour, self.minute, self.second, self.microsecond,
                        self.tzinfo)