Questions tagged [tdatetime]

48 questions
1
vote
2 answers

Comparing two TDateTime variables

I am using C++ Builder and am wanting some help to see if two times are the same. Here is my code: TDateTime appDateFromVector = TimeOf(appointmentsForFind[i].getAppDateTime()); DateTime appDateFromControl =…
user1690531
  • 231
  • 1
  • 6
  • 17
1
vote
1 answer

Extract date from date and time

I am using a VCL forms application in C++ Builder. How can I get just the date from a TDateTime object that has both a date and a time associated with it? Here is an example: TDateTime test("25/09/2012 12:00am"); I am after a TDateTime object that…
user1690531
  • 231
  • 1
  • 6
  • 17
1
vote
1 answer

Converting a string to a TDateTime variable

I am using C++ to develop an appointment system. Can I please have some help in converting a string to a TDateTime variable. Here is an example that I would like some help with; TDateTime appDateTime(2012, 9, 15, 14, 0, 0, 0); I am saving this to a…
Darryl Janecek
  • 399
  • 4
  • 9
  • 25
1
vote
2 answers

Checking two TDateTime variables

I am using C++ Builder and have the following question: I am wanting to detect if a date/time is later than another date/time, and by how much. Here is my current code: TDateTime testFirstDate("11/09/2012"); TDateTime…
Darryl Janecek
  • 399
  • 4
  • 9
  • 25
1
vote
1 answer

Delphi - Why is TDate and TDateTime the same?

when looking in System.pas there TDate und TDateTime defined as the following: TDateTime = type Double; TDate = type TDateTime; TTime = type TDateTime; obviously TDate and TDateTime are the same. I just struggled working with TDate and…
user1619275
  • 355
  • 1
  • 6
  • 14
0
votes
1 answer

Calculate time between 2 TDateTime, with a twist

I need to find out how to get the time between 2 times, but only if it is within work hours(Stored in a database) This is what I got for now, but it is totally wrong. the total won't bee correct. int __fastcall…
Qwark
  • 486
  • 11
  • 26
0
votes
1 answer

Is StrToDateTime broken in Delphi 11?

In Delphi 10.4 and older we could call StrToDateTime with custom format settings and the String would get parsed. In 11.3 this is not the case anymore. I get the following exception: Project X.exe raised exception class EConvertError with message…
kkrajnc
  • 3
  • 1
0
votes
2 answers

XSuperObject: what's wrong with this date field?

unit fmainForm; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type TForm1 = class(TForm) Memo1: TMemo; procedure…
Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551
0
votes
2 answers

Add lots of seconds to TDateTime in C++Builder 2009

I am using C++Builder 2009. I have a start date 2000/01/01 and a count of seconds from this timestamp. I want to create a TDateTime with this date. I create a start point TDateTime and add seconds. TDateTime dt(2000,1,1,0,0,0,0); AnsiString sdt…
lgabryel
  • 109
  • 1
  • 9
0
votes
3 answers

TDateTime To ShortDateString In Satellite Forms "VB-clone"

I am trying to find a calculation that will convert the TDateTime value 40653.6830593 into a year, a month, a day, an hour, a minute and a second. I am sure this is possible, of course, but my brain doesn't have the power, it seems, to write a…
Joebocop
  • 539
  • 3
  • 9
  • 17
0
votes
2 answers

Converting string to TDateTime in C++Builder 2009

I try to convert strings in specific formats to TDateTime using C++Builder 2009: TDateTime dt, dt2; TFormatSettings FS, FS2; UnicodeString datestring = "17/10/2017 13:24:33"; UnicodeString datestring2 = "2017.17.10 13:24:33"; FS.DateSeparator =…
lgabryel
  • 109
  • 1
  • 9
0
votes
1 answer

Error converting string to datetime in Delphi FireMonkey XE7

I have a problem when converting a string to TDateTime in FireMonkey , in mobile devices. It always gives me error and do not know how to do. I show you what I do: function StringToDateTime(DateStr: String): TDateTime; var FS:…
elcharlie
  • 511
  • 8
  • 25
0
votes
3 answers

Ignore milliseconds in TDateTime (Same TDateTime values subtracted are not 0)

my problem in short: TDateTime A (03.09.2014 13:40) - TDateTime B (03.09.2014 13:40) = -1 I have two TDateTime values which i want to compare, first i used the = operator to check if they are the same but after a few tests i realized that this is…
TryToSolveItSimple
  • 873
  • 1
  • 12
  • 23
0
votes
4 answers

Frac function losing precision

I have a TDateTime variable which is assigned a value at runtime of 40510.416667. When I extract the time to a TTime type variable using the Frac function, it sets it to 0.41666666666. Why has it changed the precision of the value and is there a…
PDM
  • 503
  • 2
  • 12
  • 27
0
votes
1 answer

Convert U.S. TDateTime value to correctly dispay in European format

Is there any simple option to convert a U.S. TDateTime value Apr 17, 2014 8:35:38 PM PDT to a European format looking like 2014-04-17 20:35:38? EDIT: I have a string containing raw date/time in U.S. format: var s, new_s: string; begin s := 'Apr…
Interface Unknown
  • 713
  • 10
  • 26