Skip to content

Instantly share code, notes, and snippets.

@nguyenphucbao68
Created April 1, 2017 10:57
Show Gist options
  • Save nguyenphucbao68/000fe38d02c5a04459bdf22fa2e1d481 to your computer and use it in GitHub Desktop.
Save nguyenphucbao68/000fe38d02c5a04459bdf22fa2e1d481 to your computer and use it in GitHub Desktop.
Function FormatTime for Facebook
; #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