I have a datetime field .for e.g. 2013-08-22 12:00:00 AM. I want to concatenate the year and month and i want the output as 201308.
When i try year (datetime_field)+month(datetime_field) what i get get is 2013+08=2021 .. i.e it adds instead of conactenating. Can someone pl tell how to get the output as 201308?
something more like
str(year(datetime_field)) + str(month(datetime_field))
should give you what you want.
the str
function converts your numeric data to a string, setting up the +
to be a string-concatenation operation instead of an arithmetic-addition operation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With