code: def convert(self, df: pd.DataFrame, keep_time=False) -> pd.DataFrame:
      if len(df) == 0:
          return df
  
      df = df.copy()
      if (
          df[self.date_column]
          .apply(lambda x: isinstance(x, datetime.datetime))
          .all()
      ):
          df[self.date_column] = df[self.date_column].apply(
              lambda x: x.replace(tzinfo=None)
          )
      elif isinstance(df[self.date_column].values[0], datetime.date):
          df[self.date_column] = pd.to_datetime(
              df[self.date_column], errors="coerce"
          )
      elif is_string_dtype(df[self.date_column]):
          df[self.date_column] = df[self.date_column].apply(
              self.clean_date
          )
          df[self.date_column] = self.parse_date(df)
      elif is_period_dtype(df[self.date_column]):
          df[self.date_column] = pd.to_datetime(
              df[self.date_column].astype("string")
          )
      elif is_numeric_dtype(df[self.date_column]):
          msg = f"Unsupported type of date column {self.date_column}. Convert to datetime please."
          self.logger.warning(msg)
          raise ValidationError(msg)
  
      # If column with date is datetime then extract seconds of the day and minute of the hour
      # as additional features
      seconds = "datetime_seconds"
      df[self.date_column] = df[self.date_column].dt.tz_localize(None)
      df[seconds] = (
          df[self.date_column] - df[self.date_column].dt.floor("D")
      ).dt.seconds
  
      seconds_without_na = df[seconds].dropna()
      if (
          seconds_without_na != 0
      ).any() and seconds_without_na.nunique() > 1:
          self.logger.info(
              "Time found in date search key. Add extra features based on time"
          )
          seconds_in_day = 60 * 60 * 24
          orders = [1, 2, 24, 48]
          for order in orders:
              sin_feature = f"datetime_time_sin_{order}"
              cos_feature = f"datetime_time_cos_{order}"
              df[sin_feature] = np.round(
                  np.sin(
                      2 * np.pi * order * df[seconds] / seconds_in_day
                  ),
                  10,
              )
              df[cos_feature] = np.round(
                  np.cos(
                      2 * np.pi * order * df[seconds] / seconds_in_day
                  ),
                  10,
              )
              self.generated_features.append(sin_feature)
              self.generated_features.append(cos_feature)
  
      df.drop(columns=seconds, inplace=True)
  
      if keep_time:
          df[self.DATETIME_COL] = (
              df[self.date_column].view(np.int64) // 1_000_000
          )
          df[self.DATETIME_COL] = (
              df[self.DATETIME_COL]
              .apply(self._int_to_opt)
              .astype("Int64")
          )
      df[self.date_column] = (
          df[self.date_column].dt.floor("D").view(np.int64) // 1_000_000
      )
      df[self.date_column] = (
          df[self.date_column].apply(self._int_to_opt).astype("Int64")
      )
  
      self.logger.info(
          f"Date after convertion to timestamp: {df[self.date_column]}"
      )
  
      return df
  
file_path: upgini/src/upgini/utils/datetime_utils.py
imports: import datetime
  import logging
  import re
  from typing import List, Optional
  import numpy
  import pandas
  from dateutil.relativedelta import relativedelta
  from pandas.api.types import is_numeric_dtype, is_period_dtype, is_string_dtype
  from upgini.errors import ValidationError
label_desc: Use image node_id 4 for calling the DateTimeSearchKeyConverter obj's underlying member method code with example usage: obj.convert(df, keep_time) and returns: df, df