콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
16737 화면

Hello everybody!!!!

Can anyone help me please.

I have this field type date:

2016-01-01 and i want to get the month then convert it to its name.

Need help friends please.

Best Regards.

아바타
취소

Hello Rihene, Iwould like to do the same,create a custom field with the name of the month of a date. ¿how did you solve it? Thanks

베스트 답변

#import datetime library

from datetime import datetime


month = datetime.strptime('2016-01-01', "%Y-%m-%d").strftime('%B')#Converting a string format datetime into datetime() type.

You can use different directives as per your requirement in place of "%B". You can find them \here.


Best Regards,

Kalpana Hemnani

아바타
취소
베스트 답변

Hi Drees,

     you should use split method of python

i am consider date as year-month-date

data_value='2016-01-01'

get_month=data_value.split('-)[1]

if get_month=='1':

   month_name='january'

if you have such issues issues mail me on virzoteck@gmail.com

아바타
취소
관련 게시물 답글 화면 활동
2
2월 22
29826
1
1월 20
7705
0
2월 17
3079
1
1월 16
6481
4
1월 16
6453