Delphi/Lazarus: Get TDateTime from Day, Month, Year, Hours, Minutes and Seconds
Question by Guest | 2015-10-23 at 18:35
I have some integer variables for the day, the month, the year, the hour, the minute and the second and I would like to transform this information into the DateTime format. So, I would like to create date and time out of the individual parts.
Is there any ready function for that in Delphi or Lazarus or do I have to write my own one?
Related Topics
MySQL: Group Timestamp Column by Month and Year
Tip | 0 Comments
Website Performance: Caching and Expires Header for Images, CSS and JavaScript
Tutorial | 0 Comments
Delphi/Lazarus: Display current Date and Time
Tip | 0 Comments
PHP: Current Date and Time
Tutorial | 0 Comments
JavaScript: Get current Date and Time
Tutorial | 1 Comment
Womens Carnival Day: Dates 2025, 2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017 and 2016
Info | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
You do not have to write any code function for this. Delphi as a well as Lazarus are knowing the function EncodeDateTime with which exactly your purpose is possible. Here you can see a small example for usage:
In this example, we are setting the variable ADateTime to the date 1.1.2020 and the time 20:00:00. After that, we are showing date and time as message.
Important: we have to add the unit DateUtils to our uses-section to make it work.
2015-10-24 at 20:44