title: python time now and before
body: <p>how i can do the checking. so that if the time which i write in the h m s format hasnt yet come, add yesterdays date to it</p>
  <p>for example:
  now 00:10:15 ,    i input 00:15:15    bot write 2022-09-09 00:15:15</p>
  <p>and if the time has come to add todays</p>
  <p>for example:
  now 00:10:15 , i input 00:10:00  , bot write 2022-09-10  00:10:00</p>
  <pre><code>from datetime import datetime, timezone
  import time
  from zoneinfo import ZoneInfo
  import pytz
  
  #date = datetime.now(ZoneInfo(&quot;Pacific/Kwajalein&quot;))
  
  newYorkTz = pytz.timezone(&quot;Europe/Kiev&quot;) 
  timeInNewYork = datetime.now(newYorkTz).strftime('%Y-%m-%d ')
  #date = datetime.today().strftime('%Y-%m-%d ')
  from_date = str(input('time): '))
  
  
  fulldate = timeInNewYork + from_date
  
  dt = datetime.strptime(fulldate, '%Y-%m-%d %H:%M:%S')
  epoch = dt.timestamp() 
  
  print(epoch)
  </code></pre>