Is there a way that I can label the current date from within a label expression without pulling from a field in the attribute table? I've been trying to use datetime.now() and datetime.today() but haven't been able to get those to work.
Thanks!
Tim
python python label expression
Solved! Go to Solution.
Hi Timothy,
try:
def FindLabel ( 😞
myVar = datetime.datetime.now()
return myVar.strftime("%Y-%m-%d")
you can then format from there
def FindLabel ( 😞
myVar = datetime.datetime.now()
return myVar.strftime("%Y-%m-%d %H:%M:%S")
Thanks
Wendy
Hi Timothy,
try:
def FindLabel ( 😞
myVar = datetime.datetime.now()
return myVar.strftime("%Y-%m-%d")
you can then format from there
def FindLabel ( 😞
myVar = datetime.datetime.now()
return myVar.strftime("%Y-%m-%d %H:%M:%S")
Thanks
Wendy
This worked perfectly. I was able to incorporate my existing label expression right into it.
Thanks for the help!
Tim