Description
When working with date and time in your applications it is important to consider for example:
- The different timezones
- Daylight saving time
- The current system date and time
- But also the milliseconds it takes to startup a system
The DataFlex Date & Time Library contains several functions to assist with anything date and time related in your DataFlex applications.This download contains a library and a demo application. The library can be used when working with dates and times. The library contains three classes
- cDateTimeHandler
- cMathHandler
- cLocaleInfoHandler
Note
The Conversions Library is needed to be able to install and use this library
Features
cDateTimeHandler class
This class contains the following functions:
- CompareFileTimes - Compares two time values (earlier, equal and later)
- TickCount / TickCount64 - Retrieves the number of milliseconds that have elapsed since the system was started
- SetLocalTime - Sets the current local time and date
- SystemTimes - Retrieves system timing information
- QueryPerformanceCounter - Retrieves the current value of the performance counter
- QueryPerformancePercentage - Retrieves the frequency of the performance counter
- QueryUnbiasedInterruptTime - Gets the current unbiased interrupt-time count
- SystemTime - Retrieves the current system date and time in UTC format
- SetSystemTime - Changes the system time
- SystemTimeAdjustment - Determines whether the system is applying periodic time adjustments to its time-of-day clock
- FormatSystemTimeToTime - Formats a tSystemTime value to a DataFlex Time value using the regional settings
- TimeZoneInformation - Retrieves the current time zone settings
- TimeZoneInformationForYear - Retrieves the current time zone settings for a specific year
- SystemTimeToFileTime - Helper function to convert a time value
- SystemTimeToTzSpecificLocalTime - Converts a tSystemTime value via TimeZoneInformation to a TimeZone Specific Local Time
- FileTimeToLocalFileTime - Converts a UTC file time to a local file time
- FormatSystemTimeToDate - Formats a tSystemTime value to a DataFlex Date value using the regional settings
- FileTimeToDateTime - Converts a tWinFileTime value to a DataFlex DateTime value
- SystemTimeAsFileTime - Retrieves the current system Date and Time in UTC format
- DateTimeToFileTime - Converts a DateTime value into a tWinFileTime value
- DateTimeToSystemTime - Converts a DateTime value to a tSystemTime Value
- TransitionDateTime - Converts a transition time (from DST to STD or vice-versa) to a formatted date and time
- FirstDayOfWeek - Ask the Windows API what the first day of the week is for the current locale
- FirstWeekOfYear - Ask the Windows API what the first week of a year is for the current locale
- MondayOfWeekYear - Returns the date of the monday in a given week in a given year
- StartDateFirstWeekOfYear - Returns the date of the first day of the first week in a given year
- TransitionDateTimeForYear - Converts - like the TransitionDateTime - a transition time (from DST to STD or vice-versa) to a formatted date and time
- SystemTimeToDateTime - Formats a tSystemTime value to a DataFlex DateTime value
- ISO8601WeekNumber - Returns the weeknumber of a given date according to ISO 8601
- UnixTimeToUTCDateTime - Calculates the UTC DateTime from a UNIX time
- UnixTimeToLocalDateTime - Calculates the DateTime from a UNIX time
- DateTimeToUnixTime - Returns the UNIX time from a given datetime value
- DateTimeToJavaScriptTime - Returns the JavaScript time from a given datetime value. JS time is the number of milliseconds since 1/1/1970
- JavaScriptTimeToLocalDateTime - Calculates the DateTime from a JavaScript time. JS time is the number of milliseconds since 1/1/1970
- JavaScriptTimeToUTCDateTime - Calculates the UTC DateTime from a JavaScript time. JS time is the number of milliseconds since 1/1/1970
- CurrentUTCDateTime - Gets the UTC date & time by converting the local date & time to a UNIX time which is always a UTC time
Note: The JavaScript* functions do only exist in version 20.1.1 and higher of the library
cMathHandler class
This class contains the following helper functions
- Ceiling - Returns the least integer less than or equal to the passed value
- Floor - Returns the greatest integer less than or equal to the passed value
cLocaleInfoHandler class
This class contains the following helper functions
- LocaleMonthName - Retrieves the locale value for the month name for the locale specified in psLocaleName
- LocaleDayName - Retrieves the locale value for the day name for the locale specified in psLocaleName
- LocaleShortDateFormat - Retrieves the short date format for the locale specified in psLocaleName
- LocaleLongDateFormat - Retrieves the long date format for the locale specified in psLocaleName
- LocaleTimeFormat - Retrieves the time format for the locale specified in psLocaleName
- LocaleFirstDayOfWeek - Retrieves the locale value for the first day of the week for the locale specified in psLocaleName
- LocaleFirstWeekOfYear - Ask the Windows API what the first week of a year is for the locale specified in psLocaleName
- LocaleDecimalSeparator - Retrieves the decimal separator for the locale specified in psLocaleName
- LocaleThousandsSeparator - Retrieves the thousands separator for the locale specified in psLocaleName
- LocaleCurrencySymbol - Retrieves the currency symbol for the locale specified in psLocaleName
- AllLocaleCodes - Return all possible locale codes
Screenshots
![DateTime - Filetime](https://downloads.dataaccess.com/datetime-filetime.jpg-f238&fileid=238&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=20067)
![DateTime - JavaScript Time function usage](https://downloads.dataaccess.com/datetime-javascript-time-function-usage.jpg-f239&fileid=239&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=45958)
![DateTime - Local time](https://downloads.dataaccess.com/datetime-local-time.jpg-f240&fileid=240&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=84732)
![DateTime - Locale Info](https://downloads.dataaccess.com/datetime-locale-info.jpg-f241&fileid=241&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=2363)
![DateTime - Performance](https://downloads.dataaccess.com/datetime-performance.jpg-f242&fileid=242&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=72812)
![DateTime - System Time](https://downloads.dataaccess.com/datetime-system-time.jpg-f243&fileid=243&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=51828)
![DateTime - System times](https://downloads.dataaccess.com/datetime-system-times.jpg-f244&fileid=244&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=55828)
![DateTime - Timezones](https://downloads.dataaccess.com/datetime-timezones.jpg-f247&fileid=247&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=11290)
![DateTime - tickcounts](https://downloads.dataaccess.com/datetime-tickcounts.jpg-f245&fileid=245&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=68944)
![DateTime - time adjustment](https://downloads.dataaccess.com/datetime-time-adjustment.jpg-f246&fileid=246&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=40209)
![DateTime - Unbiased time](https://downloads.dataaccess.com/datetime-unbiased-time.jpg-f248&fileid=248&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=96539)
![DateTime - Unix time](https://downloads.dataaccess.com/datetime-unix-time.jpg-f251&fileid=251&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=99245)
![DateTime - UTC](https://downloads.dataaccess.com/datetime-utc.jpg-f249&fileid=249&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=45476)
![DateTime - Weeknumber](https://downloads.dataaccess.com/datetime-weeknumber.jpg-f250&fileid=250&thumbnail=1&maxwidth=328&maxheight=185&style=2&random=40859)