Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
16318 Näkymät

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.

Avatar
Hylkää

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

Paras vastaus

#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

Avatar
Hylkää
Paras vastaus

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

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
helmik. 22
29316
1
tammik. 20
7371
0
helmik. 17
2776
1
tammik. 16
6135
4
tammik. 16
6124