PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
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
Returns or modifies the system date (date of the day defined on the current computer).
Notes:
  • WEBDEV - Server code The system date corresponds to the date of the day defined on the server.
  • This function is equivalent to Today.
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Versions 16 and later
Universal Windows 10 App This function is now available for Windows Phone applications.
New in version 16
Universal Windows 10 App This function is now available for Windows Phone applications.
Universal Windows 10 App This function is now available for Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for 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
Res = DateSys()   // Res = "20011225"
Res = DateToString(DateSys()) // Res = "25/12/2001"
Year = Left(DateSys(), 4)
// Year returns the current year (2001 for example)
WINDEVWEBDEV - Server codeReports and QueriesWindowsWindows MobileAjaxUser code (UMC)Stored procedures
// Changes the system date and displays the new date
DateSys("20020101")
Info(DateSys())
WINDEVWEBDEV - Server codeReports and QueriesWindowsLinuxAndroidAndroid Widget Windows MobileUniversal Windows 10 AppJavaPHPAjaxUser code (UMC)Stored procedures
TodaysDate is Date = DateSys()
EDT_Date = DateToDayInAlpha(TodaysDate) + " " + TodaysDate..Day + ...
" " + DateToMonthInAlpha(TodaysDate) + " at " + ...
TimeToString(TimeSys(), "HH:MM:SS")
// The EDT_Date control contains for example: Monday 13 August at 14:44:17
Syntax

Finding out the system date Hide the details

<Result> = DateSys()
<Result>: Character string or Date variable
System date in YYYYMMDD format (YYYY corresponds to the year, MM to the month and DD to the day).
WINDEVWEBDEV - Server codeReports and QueriesWindowsWindows MobileAjaxUser code (UMC)

Modifying the system date Hide the details

DateSys(<New date>)
<New date>: Character string, Date or DateTime variable
New system date. This date can correspond to:
  • a character string in YYYYMMDD format (YYYY corresponds to the year, MM to the month and DD to the day).
  • Versions 24 and later
    a character string in YYYYMMDDHHMMSSCC format (YYYY corresponds to year, MM to month, DD to day, HH to hour, MM to minutes, SS to seconds and CC to hundredths of a second (use CCC for milliseconds). In this case, only the date is taken into account.
    New in version 24
    a character string in YYYYMMDDHHMMSSCC format (YYYY corresponds to year, MM to month, DD to day, HH to hour, MM to minutes, SS to seconds and CC to hundredths of a second (use CCC for milliseconds). In this case, only the date is taken into account.
    a character string in YYYYMMDDHHMMSSCC format (YYYY corresponds to year, MM to month, DD to day, HH to hour, MM to minutes, SS to seconds and CC to hundredths of a second (use CCC for milliseconds). In this case, only the date is taken into account.
  • a Date variable.
  • Versions 24 and later
    a DateTime variable. In this case, only the date is taken into account.
    New in version 24
    a DateTime variable. In this case, only the date is taken into account.
    a DateTime variable. In this case, only the date is taken into account.
Remarks
  • To get the system date in a format other than YYYYMMDD, you must define the string format (with DateToString, Right, Left) or use the properties on the dates. The YYYYMMDD format was chosen because it allows you to check the chronology between two dates, while this would not be possible with a date in YYYYDDMM format or in YYMMDD format for example.
  • On all the current systems, the year of the system date can be included between 1980 and 2099.
  • Caution: To modify the system date, you must have the administrator rights on the current computer.
  • WEBDEV - Browser codeLinuxAndroidAndroid Widget iPhone/iPadUniversal Windows 10 AppJavaPHP In this version, DateSys can only be used to return the system date (today's date defined for the current computer or on the browser computer).
  • AndroidAndroid Widget iPhone/iPadWindows Mobile In simulation mode, the date of the PC is used. At run time, the date of the mobile device is used.
Related Examples:
Calculations on durations Unit examples (WINDEV): Calculations on durations
[ + ] Calculations on dates and times with the WLanguage functions:
- Calculate the duration between two moments (dates and times)
- Calculate a sum of durations
- Calculate an average of durations
Component : wd250std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Exemplo Datesys
// Exemplo datesys

EDT_Data_Hoje = DateSys()

// Blog com Video e Exemplo

http://windevdesenvolvimento.blogspot.com.br/2016/11/aula-980-windev-datas-15-datesys.html

https://www.youtube.com/watch?v=n1pI_RtNhgY

De matos
04 Dec. 2016
Exemplo Data - Date Para Texto
d_data_hoje is Date=DateSys()
t_hora_hoje is Time=TimeSys()
s_dhEvento is string=NumToString(d_data_hoje..Year,"04d")+"-"
s_dhEvento+=NumToString(d_data_hoje..Month,"02d")+"-"
s_dhEvento+=NumToString(d_data_hoje..Day,"02d")+"T"
s_dhEvento+=NumToString(t_hora_hoje..Hour,"02d")+":"
s_dhEvento+=NumToString(t_hora_hoje..Minute,"02d")+":"
s_dhEvento+=NumToString(t_hora_hoje..Second,"02d")+"-"
IF empresa_parametro.horario_verao=True THEN
s_dhEvento+="02:00"
ELSE
s_dhEvento+="03:00"
END
// 2016-02-09T20:22:27-02:00
//Blog Com Video Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/02/curso-windev-datas-004-transformar-data.html
De matos AMARILDO
11 Feb. 2016
WinDev for a Windows application: beware of user privileges!
When trying to set the computer's clock to a certain date / time, the functions DateSys("20151231") or TimeSys("18:00:00") will not return an error code if the computer's clock is not set (mostly because of missing admin rights). If you wish to be able to act on a returned error then use the API SetSystemTime.
Jimbo
21 May 2015