PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Format of result
  • Validity of the times
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Calculates the difference between two times in hundredths of a second.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 16 and later
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This function is now available for the Windows Phone applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
// Displays the time passed since 12:15
Diff is int
Time_Sign is string
MyResult is string

Diff = TimeDifference("1215", TimeSys())
MyResult = IntegerToTime(Abs(Diff))
IF Diff < 0 THEN Time_Sign = "-"
Info("Time passed: " + Time_Sign + Left(MyResult, 2) + " hours " + ...
Middle(MyResult, 3, 2) + " minutes " + ...
Middle(MyResult, 5, 2) + " seconds " + ...
Middle(MyResult, 7, 2) + " hundredths of a second")
Syntax
<Result> = TimeDifference(<Start Time> , <End Time>)
<Result>: Integer
Number of hundredths of a second passed between the two times. This number comes from the following operation:
<End Time> - <Start Time>.
The result is negative if <Start Time> is after <End Time>.
<Start Time>: Character string or Time variable
Start time in the following format:
  • HHMMSSCC
  • HHMMSS
  • HHMM
  • HH
<End Time>: Character string or Time variable
End time in the following format:
  • HHMMSSCC
  • HHMMSS
  • HHMM
  • HH
Remarks

Format of result

To get the duration in another format (HHMMSSCC for example), use IntegerToTime.
WINDEVWEBDEV - Server codeReports and QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppJavaPHPAjaxUser code (UMC)

Validity of the times

The validity of times passed in parameter is checked. A message is displayed if the time is invalid. The validity of a time can be checked by TimeValid.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230std.dll
Windows Mobile wp230std.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Linux wd230std.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Exemplo Diferenca Tempo
Exemplo Diferenca Tempo

n_diferenca is int=TimeDifference(EDT_Time_inicial,EDT_Time_final)
EDT_resultado=IntegerToTime(Abs(n_diferenca))
EDT_horas=EDT_resultado[[1 TO 2]]
EDT_Minutos=EDT_resultado[[3 TO 4]]
EDT_segundos=EDT_resultado[[5 TO 6]]
EDT_centesimos_segundos=EDT_resultado[[7 TO 8]]

//Frances
n_diferenca_f est entier=HeureDifférence(EDT_Time_inicial,EDT_Time_final)
EDT_resultado=EntierVersHeure(Abs(n_diferenca))
EDT_horas=EDT_resultado[[1 A 2]]
EDT_Minutos=EDT_resultado[[3 A 4]]
EDT_segundos=EDT_resultado[[5 A 6]]
EDT_centesimos_segundos=EDT_resultado[[7 A 8]]

//Blog Com Video e Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/07/curso-windev-datas-014-timedifference.html
https://www.youtube.com/watch?v=LxSIqUn-cqA

De matos AMARILDO
Jul. 27 2016
Example
// Time passed since 01/01/1998 at 12:15
sTDatahoraAgenda is string = Middle(StringToDate(EDT_DataAgendamento)+StringToTime(Middle(EDT_DataAgendamento,12,5)),1,12) //"199801011215"
Diff is string
Diff = DateTimeDifference(sTDatahoraAgenda, DateSys() + TimeSys())
//Display the time passed
//Info("Time passed: " + CR + ...
//Left(Diff, 8) + "days" + CR + ...
//Middle(Diff, 9, 2) + "hours" + CR + ...
//Middle(Diff, 11, 2) + "minutes" + CR + ...
//Middle(Diff, 13, 2) + "seconds" + CR + ...
//Middle(Diff, 15, 2) + "hundredths of a second")

//Valida data
nSMinutos is int = Val(Middle(Diff, 11, 2))
IF CBOX_Agendamento..Value = True AND Middle(Diff, 11, 2) < 30
Info("A data e hora agendada tem que ser maior do que 30 minutos")
ok1 = False
ELSE
ok1 = True
END
adrianoboller
Nov. 27 2015