Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

datetime to string python

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

Convert Python Datetime to String

# 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))
Comment

datetime to string

# 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')

Comment

PREVIOUS NEXT
Code Example
Python :: python environment variable 
Python :: __dict__ 
Python :: test pypi 
Python :: python how to create a class 
Python :: django pytest how to load data 
Python :: How to solve not in base 10 in python when using decimals 
Python :: how to convert time from one timezone to another in python 
Python :: how to get the time zones in python 
Python :: count pairs with given sum python 
Python :: python in intellij 
Python :: pdf to word 
Python :: 3d graph python 
Python :: python singleton module 
Python :: rotate matrix 90 degrees clockwise in python 
Python :: densenet python keras 
Python :: python package install 
Python :: instance of object 
Python :: python error 
Python :: sort a dataframe 
Python :: how to make a variable in python 
Python :: read yml file in python 
Python :: try and exception 
Python :: Tree recursive function 
Python :: how to make a modulo in python 
Python :: speechapi 
Python :: punto1 
Python :: doormat pattern python 
Python :: how to save xml file in python 
Python :: pomodoro timer in python 
Python :: installing python3.8 in rpi 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =