Datetime To String

[Solved] Datetime To String | Elixir - Code Explorer | yomemimo.com
Question : datetime to string python

Answered by : juan-david-morales-navarrete

import datetime
t = datetime.datetime(2012, 2, 23, 0, 0)
t.strftime('%m/%d/%Y')

Source : https://stackoverflow.com/questions/10624937/convert-datetime-object-to-a-string-of-date-only-in-python | Last Update : Thu, 17 Mar 22

Question : convert datetime to string

Answered by : you

import datetime
# Current datetime object
current_datetime = datetime.datetime.now()
# Convert datetime object to string
datetime_string = current_datetime.strftime("%Y-%m-%d %H:%M:%S")
print(datetime_string)

Source : | Last Update : Tue, 19 Sep 23

Question : datetime object to string

Answered by : samer-saeid

from datetime import datetime
# current date and time
now = datetime.now()
t = now.strftime("%H:%M:%S")
print("time:", t)
s1 = now.strftime("%m/%d/%Y, %H:%M:%S")
# mm/dd/YY H:M:S format
print("s1:", s1)
s2 = now.strftime("%d/%m/%Y, %H:%M:%S")
# dd/mm/YY H:M:S format
print("s2:", s2)

Source : | Last Update : Fri, 03 Jun 22

Question : Convert Python Datetime to String

Answered by : softhunt

# Python program to demonstrate datetime object
# import datetime class
from datetime import datetime as date
# Getting current date and time
now = date.now()
string = date.isoformat(now)
print(string)
print(type(string))

Source : https://softhunt.net/python-datetime-with-6-main-classes-and-examples/ | Last Update : Mon, 06 Jun 22

Question : datetime to string python

Answered by : powerful-partridge-sej1tn11ho58

from datetime import datetime
now = datetime.now() # current date and time
year = now.strftime("%Y")
print("year:", year)
month = now.strftime("%m")
print("month:", month)
day = now.strftime("%d")
print("day:", day)
time = now.strftime("%H:%M:%S")
print("time:", time)
date_time = now.strftime("%m/%d/%Y, %H:%M:%S")
print("date and time:",date_time)

Source : https://www.programiz.com/python-programming/datetime/strftime | Last Update : Thu, 31 Mar 22

Question : datetime to string

Answered by : akintunde-i-makinde

# You can use Numpy's datetime_as_string function.
# The unit='D' argument specifies the precision, in this case days.
t = numpy.datetime64('2012-06-30T20:00:00.000000000-0400')
numpy.datetime_as_string(t, unit='D')

Source : https://stackoverflow.com/questions/19502506/convert-numpy-datetime64-to-string-object-in-python | Last Update : Sun, 08 May 22

Answers related to datetime to string

Code Explorer Popular Question For Elixir