hold datetime Convert to string 
datetime.strftime("%Y-%m-%d-%H")
Convert a string to datetime
datetime.strptime(datetime, "%Y-%m-%d-%H")
Put the string str Convert to timestamp
time.mktime(string_toDatetime(str).timetuple())
Put the time stamp stamp Convert to string form
time.strftime("%Y-%m-%d-%H", tiem.localtime(stamp))
hold datetime The type turns out to be a timestamp form
time.mktime(datetime.timetuple())

python Of datetime More articles on common methods

  1. python in datetime Common methods

    # Computable time method package >>> import datetime >>> import time >>> res = datetime.dateti ...

  2. python Of datetime Module processing time

    python Of datetime The module is mainly used to deal with time , There are many classes in it , Include timedelay,date,time,datetime etc. It is often used in development datetime class , This is a date time ...

  3. Python Of datetime

    Python Of datetime Always use date formatting and string to date , Paste the code for reference , Actually API It's really complete , But I don't know the details method... datetime.datetime.strftime ...

  4. python of datetime Time date And timestamp conversion

    Go straight to the code There are notes #coding=utf-8 import time import datetime def yes_time(): # Get the current time now_time = datetime.da ...

  5. be based on Python Of datetime Module and time Module source code reading analysis

    Catalog 1 Preface   2 datetime.pyi Source code analysis step by step 2.1 Head definition source code analysis 2.2 tzinfo Class source code analysis 2.3 date Class source code analysis 2.4 time Class source code analysis 2.5 timedelta ...

  6. python in os Common methods

    python in OS Common methods Python In the standard library of os Modules contain common operating system functions . If you want your program to be platform independent , This module is particularly important . That is, it allows a program to be written without any changes , And there won't be any questions ...

  7. Pandas Timestamp and python in datetime Cross conversion

    Pandas Of Timestamp and python Of datetime,    There are two different types . They can be transformed into each other . refer to: https://www.jianshu.com/p/ ...

  8. Lonely lotus Ling Han taught himself python Day 31 python Of datetime.timedelta modular

      Lonely lotus Ling Han taught himself python Day 31 python Of datetime.timedelta modular ( The complete learning process screen records the video address at the end of the article , Handwritten notes at the end of the text ) datetime.timedelta A module is a representation ...

  9. Lonely lotus Ling Han taught himself python Thirtieth days python Of datetime.datetime modular

      Lonely lotus Ling Han taught himself python Thirtieth days python Of datetime.datetime modular ( The complete learning process screen records the video address at the end of the article , Handwritten notes at the end of the text ) datetime.datetime The module contains :datet ...

Random recommendation

  1. SVN And TortoiseSVN actual combat : Details of the conflict ( One )

    Hard wide :<SVN And TortoiseSVN actual combat > The series has written three , Chapter one <SVN And TortoiseSVN actual combat : From entry to mastery >, Second articles <SVN And TortoiseSVN actual combat : label ...

  2. adopt gradle Run the test script ( turn )

    Exercise one :HelloWorld Create project , The source code in src/main/java, Test source code in src/test/java build.gradle Script for : apply plugin: 'java' depe ...

  3. HTTP On Agency

    To put it simply HTTP Agency is in the position of HTTP Between client and server , The middleman of the transfer message . One proxy is to request the server on behalf of the client , be called Forward Proxy Forward agency : The other is to act as a real server to receive user requests , be called Rev ...

  4. To give you a deeper understanding of STL And Vector Containers

    C++ Built in array types , When using arrays , You must specify the length of the array , Once configured, it can't be changed , We usually do it by : Try to allocate a large space , In case it's not enough , The disadvantage of this is that it is a waste of space , Improper estimation of space can cause a lot of inconvenience . ST ...

  5. PE Knowledge review PE Import table

    PE Knowledge review PE Import table I. Introduction The last lecture explained exporting tables . That's one PE When files are used by others . Derived function   Address of function The name of the function Serial number wait . A process is a group of PE The documents constitute .  PE Files need to depend on those ...

  6. take docker Upload the image to docker hub

  7. python The way -----MySql operation

    One . summary 1. What is a database The database is organized according to the data structure . Warehouse for storing and managing data . Like the folder we created , It's a database . 2. What is? mysql,oracle,access,sqlit etc. ? They're all software ...

  8. QWaiteCondition reflection 4

    quote http://blog.csdn.net/flyoxs/article/details/54617342 It is easy to use QWaitCondition Synchronization for multithreading , One thread call QWaitCond ...

  9. preview InputFile

    [ preview InputFile] adopt input Of files attribute , You can get a choice of File object , adopt FileReader Can be File Object read out . <body> <input type=& ...

  10. NPOIHelp Export by fixed template and export directly

    The complete code is as follows using System; using System.Collections.Generic; using System.Data; using System.Text; using N ...