shrug-l: Extracting the year out of a date field and inputting that value in an Origin year field
Janelle Versnick
jversnick at HNTB.com
Mon Nov 15 14:24:40 EST 2021
EXTERNAL MESSAGE
This email originated outside of DEP. Please use caution when opening attachments, clicking links, or responding to this email.
Good Afternoon Scott,
I’ve attached a getYear calc expression you can import to the field calculator. Just change the field from ‘today’ to wherever you have your date.
This assumes the date look like this: 11/15/2021 2:18:15 PM
If you do not have a timestamp, just the date, change this portion of the code:
dt = today.split(' ')[0]
to
dt = today
if your dates are arranged differently, change the highlighted
month, day, year = (int(x) for x in dt.split('/'))
You can email me if you have any issues with the code or need help 😊
Janelle Versnick, GISP
GIS Team Leader
Technology Group
Direct (850) 536-8522 Cell (850) 879-2374 Tallahassee Office (850) 878-9777
HNTB CORPORATION
1276 Metropolitan Blvd, Suite 304, Tallahassee, FL, 32312 | www.hntb.com<http://www.hntb.com/>
■ 100+ YEARS OF INFRASTRUCTURE SOLUTIONS
[cid:image008.jpg at 01D7DA2C.48673AE0]<https://twitter.com/HNTBCorp> [cid:image009.png at 01D7DA2C.48673AE0] <https://www.youtube.com/user/hntbcorp?feature=results_main> [cid:image010.jpg at 01D7DA2C.48673AE0] <http://www.linkedin.com/company/hntb?trk=tyah> [cid:image011.png at 01D7DA2C.48673AE0] <https://www.facebook.com/HNTBCorp>
From: SHRUG-L <shrug-l-bounces at lists.dep.state.fl.us> On Behalf Of Scott Crosby
Sent: Monday, November 15, 2021 2:03 PM
To: SHRUG-L at lists.dep.state.fl.us
Subject: shrug-l: Extracting the year out of a date field and inputting that value in an Origin year field
EXTERNAL MESSAGE
This email originated outside of DEP. Please use caution when opening attachments, clicking links, or responding to this email.
Hi all,
I’m working with a timber stand layer and need to extract the year out of an Establishment date field (type is date) and input that value in an Origin year field (type is short integer). I see where there is an option in Field Calculator to calculate dates, but it appears that this can’t be done in Field Calculator (I’ve tried several different times, but no success). Has someone written a python script that will do this extraction and input that value as a short integer into another field, or is there a tool in Arc Toolbox that will do this?
Thanks,
[cid:image001.png at 01D7DA2B.CF523880]<http://www.alachuacounty.us/Pages/AlachuaCounty.aspx>
Scott Crosby, SAF Certified Forester
Senior Environmental Specialist
Land Conservation and Management
408 W. University Ave Suite 106 • Gainesville • FL • 32601
352-264-6823 (office) • 352-213-0024 (mobile)
[cid:image002.png at 01D7DA2B.CF523880]<http://www.alachuacounty.us/Pages/AlachuaCounty.aspx> [cid:image003.png at 01D7DA2B.CF523880] <https://www.facebook.com/AlachuaCounty/> [cid:image004.png at 01D7DA2B.CF523880] <https://twitter.com/alachuacounty> [cid:image005.png at 01D7DA2B.CF523880] <https://www.instagram.com/alachuacounty/> [cid:image006.png at 01D7DA2B.CF523880] <https://www.youtube.com/user/alachuacounty> [cid:image007.png at 01D7DA2B.CF523880] <http://www.alachuacounty.us/depts/communications/pages/updatenewsletter.aspx>
PLEASE NOTE: Florida has a very broad public records law (F.S.119).
All e-mails to and from County Officials and County Staff are kept as public records. Your e-mail
communications, including your e-mail address, may be disclosed to the public and media at any time.
..
This e-mail and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed. If you are NOT the intended recipient and receive this communication, please delete this message and any attachments. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20211115/3f1729d2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 13186 bytes
Desc: image001.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20211115/3f1729d2/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 1595 bytes
Desc: image002.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20211115/3f1729d2/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 1540 bytes
Desc: image003.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20211115/3f1729d2/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 927 bytes
Desc: image004.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20211115/3f1729d2/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 2318 bytes
Desc: image005.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20211115/3f1729d2/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 838 bytes
Desc: image006.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20211115/3f1729d2/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image007.png
Type: image/png
Size: 2067 bytes
Desc: image007.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20211115/3f1729d2/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image008.jpg
Type: image/jpeg
Size: 756 bytes
Desc: image008.jpg
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20211115/3f1729d2/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image009.png
Type: image/png
Size: 517 bytes
Desc: image009.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20211115/3f1729d2/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image010.jpg
Type: image/jpeg
Size: 755 bytes
Desc: image010.jpg
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20211115/3f1729d2/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image011.png
Type: image/png
Size: 638 bytes
Desc: image011.png
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20211115/3f1729d2/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getYear.cal
Type: application/octet-stream
Size: 536 bytes
Desc: getYear.cal
URL: <http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20211115/3f1729d2/attachment.obj>
More information about the SHRUG-L
mailing list