Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
e2e178e0
Kaydet (Commit)
e2e178e0
authored
Mar 01, 2015
tarafından
Alexander Belopolsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Closes issue #22791: Improved datetime from timestamp methods documentation.
Original patch by Akira Li.
üst
3de4aae1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
8 deletions
+13
-8
datetime.rst
Doc/library/datetime.rst
+11
-5
datetime.py
Lib/datetime.py
+1
-1
_datetimemodule.c
Modules/_datetimemodule.c
+1
-2
No files found.
Doc/library/datetime.rst
Dosyayı görüntüle @
e2e178e0
...
...
@@ -759,13 +759,19 @@ Other constructors, all class methods:
:attr:`tzinfo` ``None``. This may raise :exc:`OverflowError`, if the timestamp is
out of the range of values supported by the platform C :c:func:`gmtime` function,
and :exc:`OSError` on :c:func:`gmtime` failure.
It's common for this to be restricted to years in 1970 through 2038. See also
:meth:`fromtimestamp`.
It's common for this to be restricted to years in 1970 through 2038.
To get an aware :class:`.datetime` object, call :meth:`fromtimestamp`::
datetime.fromtimestamp(timestamp, timezone.utc)
On the POSIX compliant platforms, it is equivalent to the following
expression::
On the POSIX compliant platforms, ``utcfromtimestamp(timestamp)``
is equivalent to the following expression::
datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)
datetime(1970, 1, 1) + timedelta(seconds=timestamp)
except the latter formula always supports the full years range: between
:const:`MINYEAR` and :const:`MAXYEAR` inclusive.
.. versionchanged:: 3.3
Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp
...
...
Lib/datetime.py
Dosyayı görüntüle @
e2e178e0
...
...
@@ -1393,7 +1393,7 @@ class datetime(date):
@classmethod
def
utcfromtimestamp
(
cls
,
t
):
"
Construct a UTC datetime from a POSIX timestamp (like time.time()).
"
"
""Construct a naive UTC datetime from a POSIX timestamp.""
"
t
,
frac
=
divmod
(
t
,
1.0
)
us
=
int
(
frac
*
1e6
)
...
...
Modules/_datetimemodule.c
Dosyayı görüntüle @
e2e178e0
...
...
@@ -5020,8 +5020,7 @@ static PyMethodDef datetime_methods[] = {
{
"utcfromtimestamp"
,
(
PyCFunction
)
datetime_utcfromtimestamp
,
METH_VARARGS
|
METH_CLASS
,
PyDoc_STR
(
"timestamp -> UTC datetime from a POSIX timestamp "
"(like time.time())."
)},
PyDoc_STR
(
"Construct a naive UTC datetime from a POSIX timestamp."
)},
{
"strptime"
,
(
PyCFunction
)
datetime_strptime
,
METH_VARARGS
|
METH_CLASS
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment