함수 datetime2unixtime()

함수 datetime2unixtime()
함수 datetime2timestamp()

1 Bash[ | ]

echo "2014-07-24 21:16:36" | date +%s
# 1406204196
datetime="2014-07-24 21:16:36"
date +%s --date "$datetime"
# 1406204196
datetime="2014-07-24 21:16:36"
unixtime=`date +%s --date "$datetime"`
echo $unixtime
# 1406204196

2 Excel[ | ]

// A1 = 2013-05-15  5:55:01 AM
=(A1-DATE(1970,1,1))*86400
// 1368597301

3 Go[ | ]

package main

import (
	"fmt"
	"time"
)

func main() {
	t, _ := time.Parse(time.RFC3339, "2014-07-24T21:16:36Z")
	fmt.Println(t.Unix()) // 1406236596 (UTC)
}

4 JavaScript[ | ]

var date = "2014-07-24 21:16:36";
console.log( new Date(date).getTime() ); // 1406204196000 (in KST)

5 PHP[ | ]

$datetime = "2014-07-24 21:16:36";
$unixtime = date('U', strtotime($datetime));
echo $unixtime; // 1406236596 (UTC)

6 Python[ | ]

import time
dt = "2014-07-24 21:16:36"
ut = time.mktime(time.strptime(dt, "%Y-%m-%d %H:%M:%S"))
print ut
# 1406204196.0

7 같이 보기[ | ]

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