"함수 now (unixtime)"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(다른 사용자 한 명의 중간 판 5개는 보이지 않습니다)
4번째 줄: 4번째 줄:
==Bash==
==Bash==
[[category: Bash]]
[[category: Bash]]
<source lang='Bash'>
<syntaxhighlight lang='Bash'>
date +%s
date +%s
# 1410042079
# 1410042079
</source>
</syntaxhighlight>


==PHP==
==PHP==
[[category: PHP]]
[[category: PHP]]
<source lang='PHP'>
<syntaxhighlight lang='PHP'>
echo time();
echo time();
# 1410042079
# 1410042079
</source>
</syntaxhighlight>
<source lang='PHP'>
<syntaxhighlight lang='PHP'>
echo date('U');
echo date('U');
# 1410042079
# 1410042079
</source>
</syntaxhighlight>


==Python==
==Python==
[[category: Python]]
[[category: Python]]
<source lang='Python'>
<syntaxhighlight lang='Python'>
import time
import time
print( time.time() )
print( time.time() )
# 1408692469.768158
# 1408692469.768158
</source>
</syntaxhighlight>
 
==Ruby==
[[category: Ruby]]
<syntaxhighlight lang='Ruby'>
puts Time.now.to_i
# 1410043717
puts Time.new.to_i
# 1410043717
</syntaxhighlight>
<syntaxhighlight lang='Ruby'>
puts Time.now.to_f
# 1410043717.22767
puts Time.new.to_f
# 1410043717.22767
</syntaxhighlight>


==같이 보기==
==같이 보기==
*[[now]] (datetime)
*[[now]] (datetime)
*[[now (iso8601)]]
*[[unixtime2datetime]]
*[[unixtime2datetime]]
*[[unixtime]]

2020년 11월 2일 (월) 02:33 기준 최신판

함수 now (unixtime)
now (timestamp)

1 Bash[ | ]

date +%s
# 1410042079

2 PHP[ | ]

echo time();
# 1410042079
echo date('U');
# 1410042079

3 Python[ | ]

import time
print( time.time() )
# 1408692469.768158

4 Ruby[ | ]

puts Time.now.to_i
# 1410043717
puts Time.new.to_i
# 1410043717
puts Time.now.to_f
# 1410043717.22767
puts Time.new.to_f
# 1410043717.22767

5 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}