i use datepart() to extract year and month from current date and populate a field with "YYYYMM". but month parameter in datepart function doesnt allow setting it to always have two digits.
how can i extract month as MM as default? (for example March would be '03' instade of '3')
Does the following expression (Python Parser) work for you on a TEXT field?
If it doesn't, please provide a few more details
- What type of feature class (Shapefile, File GDB Feature Class, Enterprise FC-Oracle, PostgreSQL, SQL Server, etc.)?
- What expression have you got so far? Screenshot would help.
- Version of ArcGIS Pro?
Calculate Field Python examples—ArcGIS Pro | Documentation has examples
shows all the parts and the result
so as Jayanta says, you just need to parse the bits in the order you want
Where field1 is your field containing the data and your output field is a text field.
Note datetime and time are always available in the field calculator