![]() ToString end var aDateTime : TDateTime begin aDateTime := now WriteLn ( 'Date: ' + FormatDateTime ( 'yyyy-mm-dd', aDateTime )) // WriteLn ( 'Combined date and time in UTC: ' ) WriteLn ( ' ' + ISO8601_Combined_date_and_time_in_UTC ( aDateTime, '+00:00' )) // T12:18:47+00:00 WriteLn ( ' ' + FormatDateTime ( 'yyyymmdd"T"hhmmss', aDateTime ) + 'Z' ) // 20180926T121847Z Writeln ( ' ' + ISO8601_Combined_date_and_time_in_UTC ( aDateTime, 'Z' )) // WriteLn ( 'Week: ' + ISO8601_week ( aDateTime ) ) // 2018-W39 WriteLn ( 'Date with week number: ' + ISO8601_Date_with_week_number ( aDateTime )) // 2018-W39-3 WriteLn ( 'Ordinal date: ' + ISO8601_Ordinal_date ( aDateTime )) // 2018-269 ReadLn end. 2018-269 function ISO8601_Ordinal_date ( a_DateTime : TDateTime ) : string begin result := FormatDateTime ( 'yyyy', a_DateTime ) + '-' + ( DayOfTheYear ( a_DateTime )). ToString + '-' + ( DayOfTheWeek ( a_DateTime )). Description: UnPackTime converts the file-modification time in p to a DateTime record. 2018-W39-3 function ISO8601_Date_with_week_number ( a_DateTime : TDateTime ) : string begin result := FormatDateTime ( 'yyyy', a_DateTime ) + '-W' + ( WeekOf ( a_DateTime )). Declaration: Procedure UnPackTime (p: longint var T: datetime). ToString end // Date with week number: e.g. 2018-W39 function ISO8601_week ( a_DateTime : TDateTime ) : string begin result := FormatDateTime ( 'yyyy', a_DateTime ) + '-W' + ( WeekOf ( a_DateTime )). Program iso_8601_project Uses SysUtils, DateUtils // Combined date and time in UTC e.g // function ISO8601_Combined_date_and_time_in_UTC ( a_DateTime : TDateTime a_Time_zone : string ) : string begin result := FormatDateTime ( 'yyyy-mm-dd"T"hh:mm:ss', a_DateTime ) + a_Time_zone end // Week: e.g. function Now : TDateTime Adding and subtracting TDateTime Unit DateUtils function DaysBetween tell number of whole days between two DateTime values. Gives the week of the year for a TDateTime value 1 Get current time 2 Adding and subtracting TDateTime 3 Set Date 4 Compare two TDateTime 5 See also Get current time Unit SysUtils function Now retrieves the current system date and time. Gives a string representation of a TDateTime value with a given format Gives the day of the year for a TDateTime value Gives day of week index for a TDateTime value ![]() Gives day of month index for a TDateTime value The time zone can be indicated by marking the time difference between the coordinated universal time (UTC) as follows: The combined date and time should be marked with the letter "T":īut often the intermediate letter "T" can be replaced by a space. The SS is seconds from the beginning of the previous minute between 00 and 59. The MM is minutes from the beginning of the previous hour between 00 and 59. Where HH has hours after midnight between 00 and 23. Where YYYY is a year in the Gregorian calendar, MM is a month between 01 (January) and 12 (December), and DD is the day of the month between 01 and 31. ISO 8601 is a standard issued by the International Organization for Standardization (ISO) for the date and time.Īccording to ISO 8601, the date is as follows: as described in Help:Īttached patch adds function frFormatDateTime - similar to FormatDateTime but with fdoInterval option set.│ English (en) │ suomi (fi) │ русский (ru) │ Additional information:Īn option fdoInterval is not used by LazReport, so there is no possibility to properly format time periods (intervals) longer than 24 (for hours) or 60 (for minutes and seconds), even though FPC RTL functions FormatDateTime and DateTimeToString can do that when format string contains brackets. How to convert a timestamp/date/datetime to a different timezone in Google BigQuery. Run program and click button to preview the report. ![]() Put button with OnClick = frReport1.ShowReport Set its format to Date and custom format string to ':nn'. Start new project and put the TfrReport on the form. Original Reporter info from Mantis: Bartek Dajewskiįormat strings with brackets, e.g.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |