Date data types | Python for Beginners [15 of 44]

preview_player
Показать описание
As you might expect, you sometimes need to figure out when something will happen. See how Python supports dates

#microsoftdeveloper #pythonforbeginners #learntocode
Рекомендации по теме
Комментарии
Автор

If you use the "f-string" formatting the other guy mentioned, you don't need to change integers to strings. For example, 'Yesterday was: ' + str(yesterday) becomes just f'Yesterday was {yesterday}'

walterwhite
Автор

Excellent explanation!!! What a pitty it wasn´t before the homework!!!

davidantoniofajardoponce
Автор

Great tip here: just ditch the "+" plus sign and start to use comma which can avoid the string and integer drama. The plus sign has double meanings: addition in math and go together in space and this is super confusing for Python because Python doesn't know whether you want it to just juxtapose the two string/integer or you want to add them together as two numbers. But if you simply use a comma, well, what else can a comma mean? It only has one meaning: juxtapose the two elements side by side.

aaronxiang
Автор

0:01 Importing date functions from a library.
4:00 Portions.
7:00 Errors.

HECTORARTUROA
Автор

BTW striptime '%d/%m/%Y' doesnt work for me somehow. Only %d is highlighted in blue. i might have to look for the documentation on that function.

ashnabwad
Автор

Great class and great material covered

damirko
Автор

Great job, clear explanations and a good pace. Thank you Microsoft.

craigwarren
Автор

What a coincidence that I am learning this on 1st of March, and yesterday was 29th Feb of a Leap Year !!!

ImranKhan-osdd
Автор

import datetime ???
without it command is not running in vsc .


import datetime
current_date = datetime.datetime.now()
print ('today is :' + str (current_date))

reazulislam
Автор

Please help me
I'm totally new to programming learning python as my first language

I always get this error:
ImportError: cannot import name 'datetime' from partially initialized module 'datetime' (most likely due to a circular import)

It runs fine when I debug and then run it on VScode but debugging shows no errors

shyamtripathi
Автор

in the example date of your birthday: " birthday=date.strptime(current_date, "%d/%m/%y") " If the year we want to introduce is 1919 Phyton interprets it as 2019, why?

donferisi
Автор

I'd suggest taking some notes on this lesson and playing around with the datetime function a little to understand it properly since it can be a bit mind numbing if you just gloss over the video and don't take the time to fully understand it.

andreiarg
Автор

i get an error when i type it exactly like that:
raise ValueError("time data %r does not match format %r" %
line 568 in strptime_datetime
line 349 in strptime
'03/22/85' does not match format '%m/%d/y'

thepun
Автор

May I know, why are you using upper case of Y int the assignment of year. When I used lower case it stopped with error

swachcharitharaghunathan
Автор

Hi, i had an error with a highlighted %d . the code won't run

mohamedesam
Автор

L =float(input('Amount borrowed '))
i =float(input('Interest per annum '))
n =float(input('Years to payoff '))
print(type(n))
print (n)
M = L(i(1 + i)n)/((1 + i)n-1)
Why am I getting 'unknown token' regarding the 'n' variable in the last line?

vdpeer
Автор

what can we refer after completion of this course? i want to go for advanced course now.

khushbookhairkar
Автор

microsoft should respond to the problems that coders have in the comments section!

rj
Автор

The year portion, on line 2, asks for all 4 numbers (e.g 2019 instead of 19).
Line 3 asks for 2 numbers (%Y).
when I tried to run it, while putting in all four numbers, the program crashed and said it had 2 remaining number.
It worked when I put 2 numbers in for the year.

meirlieberman
Автор

I have question on line: current_date = datetime.now() Why i have to add
.now() on datetime
and
whats the reason for having: ()

qiamudien