Author Topic: [Python] How to access the current time  (Read 3418 times)

0 Members and 1 Guest are viewing this topic.

Offline sharpieTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 1
  • sharpie has no influence.
  • Gender: Male
  • Respect: 0
  • Referrals: 0
    • View Profile
[Python] How to access the current time
« on: September 18, 2018, 02:39:06 PM »
0
Hi! I've been learning Stealth/Python and I've run into a snag. I can't seem to figure out how to actually make a variable with the current time. Most of the stuff in the API gives me name 'xyz' is not defined. I'm sure there's an easy way!

Ex:

I'm trying to use Now in the WaitJournalLine command.

findMsg = WaitJournalLine(Now(), endMsg + "|" + stopMsg, 25000)

Offline ZeroDX

  • Stealth Developer
  • Moderator
  • *****
  • Posts: 34
  • Activity:
    0%
  • Reputation Power: 1
  • ZeroDX has no influence.
  • Respect: +1
  • Referrals: 0
    • View Profile
Re: [Python] How to access the current time
« Reply #1 on: September 18, 2018, 09:07:08 PM »
0
Code: [Select]
import datetime

now = datetime.datetime.now()
findMsg = WaitJournalLine(now, endMsg + "|" + stopMsg, 25000)

Code: [Select]
from datetime import datetime as dt

findMsg = WaitJournalLine(dt.now(), endMsg + "|" + stopMsg, 25000)

Offline sharpieTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 1
  • sharpie has no influence.
  • Gender: Male
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: [Python] How to access the current time
« Reply #2 on: September 19, 2018, 12:13:14 AM »
0
Thank you!!

Tags: