Chinaunix

标题: python 下如何获取当前时间的时间戳? [打印本页]

作者: duketang    时间: 2007-03-27 12:05
标题: python 下如何获取当前时间的时间戳?
RT

或者如何将格式化时间 转换成时间戳
作者: zzjcs1971    时间: 2007-03-27 12:28
原帖由 duketang 于 2007-3-27 12:05 发表
RT

或者如何将格式化时间 转换成时间戳

>>>import time
>>> time.time()
作者: duketang    时间: 2007-03-29 00:02
thanks
作者: http80    时间: 2012-09-25 10:49
我自写翻译了一个,英语水平不是很好,有需要可以参考一下:http://www.yiibai.com/python/python_date_time.html
作者: linux_c_py_php    时间: 2012-09-25 12:20
classmethod datetime.strptime(date_string, format)

查手册, 看如何使用这个函数, 这在C中是有同样的接口的:
  1. NAME
  2.        strptime - convert a string representation of time to a time tm structure

  3. SYNOPSIS
  4.        #define _XOPEN_SOURCE /* glibc2 needs this */
  5.        #include <time.h>

  6.        char *strptime(const char *s, const char *format, struct tm *tm);
复制代码





欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2