Created
April 1, 2017 10:57
-
-
Save nguyenphucbao68/000fe38d02c5a04459bdf22fa2e1d481 to your computer and use it in GitHub Desktop.
Function FormatTime for Facebook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; #FUNCTION# ==================================================================================================================== | |
; Name ..........: _FOrmatTime | |
; Description ...: Format Time của Api Facebook thành giây | |
; Syntax ........: _FOrmatTime($string) | |
; Parameters ....: $string - String Time. | |
; Return values .: Success : Trả về giây | |
; Failure : @error set về 0 | |
; Author ........: Trojan Nguyen | |
; =============================================================================================================================== | |
Func _FormatTime($string) | |
IF $string="" then SetError(1,0,0) | |
Local $time | |
$string = StringReplace($string, "T", " ") ; | |
$string = StringReplace($string, "+0000", "") ; XÓA BỎ CÁC KÝ TỰ KHÔNG CẦN THIẾT (múi giờ,...) | |
$string = StringReplace($string, "-", "/") ; | |
$time = _DateDiff('s', "1970/01/01 00:00:00", $string) | |
Return $time | |
EndFunc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment