함수 datetime2unixtime()

(함수 datetime2unixtime에서 넘어옴)
함수 datetime2unixtime()
함수 datetime2timestamp()

1 Bash[ | ]

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

2 Excel[ | ]

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

3 Go[ | ]

Go
CPU
-1.0s
MEM
-0M
-1.0s
Copy
package main

import (
	"fmt"
	"time"
)

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

4 JavaScript[ | ]

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

5 PHP[ | ]

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

6 Python[ | ]

Python
Copy
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 같이 보기[ | ]