Date query in python calendar?

Asked

Viewed 832 times

-1

I’ve been studying python for just over a week, but I’d like to perform a more action or bros as follows.

will be placed the monetary value and places the day of closing the card and the day of payment of the invoice.

when making a purchase it consults the calendar and checks, this within the closing date of the card this month or not...

arrived on the payment day of the invoice automatically subtracts the amount that was made in the credit card purchases in the month.

If anyone can help you understand, I’m not getting !

Thank you !

I’m studying python with just over a week but would like to perform a more or Less hands action as Follows.

be the place the monetary value and the closing day of the card and the day of payment of the Invoice.

when making a query he consults the Calendar and checks, this is Within the closing date of the card this Month or not ...

Arrived on the Bill payment day Automatically subtracts the amount that was made on credit card Purchases in the Month.

If I can help, I can’t!

Thank you!

  • Hello Rodrigo, here is the OS in Portuguese. It is not necessary the English part of your question.

  • Okay, thanks I didn’t know !

1 answer

0

Responding only to the title.

Welcome to stackoverflow Rodrigo, you can use the datetime library and import the datetime. Take a look at this code for Python 3.

# importação da biblioteca datetime
from datetime import datetime

# Checagem dos dados nesse momento de acordo com o seu computador
data = datetime.now()

# Vamos 'formatar' a saída. Dia, Mes, Ano, Hora, Minuto e Segundo'
data_print = data.strftime('%d/%m/%Y %H:%M:%S')

# Vamos exibir as informações
print(data_print)

Answering the question in general

# Vamos importar o datetime
from datetime import datetime

# Vamos definir que esse será o dia da fatura
data_da_fatura = '05/04/2019'

# Checagem dos dados nesse momento de acordo com o seu computador
data = datetime.now()

# Vamos 'formatar' a saída. Dia, Mes, Ano, Hora, Minuto e Segundo' e converter para string com o str()
data_dados = str(data.strftime('%d/%m/%Y'))

# Vamos usar o if para checar se a data da fatura chegou
if data_da_fatura == data_dados:

    # Um indicador que está funcionando
    print('subtrair')

From here, I think you can use creativity to use these concepts in your study

  • 1

    Thank you, I’ll try !

Browser other questions tagged

You are not signed in. Login or sign up in order to post.