import datetime
import time


class Util:
    @staticmethod
    def datetime_timestamp(d: datetime.datetime):
        """
        时间转换成时间戳
        :param d:
        :return:
        """
        return time.mktime(d.timetuple())

    @staticmethod
    def timestamp_datetime(stamp: float):
        """
        时间戳转换成时间
        :param stamp:
        :return:
        """
        return datetime.datetime.fromtimestamp(stamp)