Advantage 12

In the code below I decode a date and time from two different DateTime fields and then using the results of these two decoding actions and encode a date and time into a DateTime variable and then used this variable to populate the date and time into a third DateTime Field.

The problem is that the database field does not accept the time value. Directly below is an image of the showmessage that is in the code shown at the bottom of the post.

alt text

with DataOffMgrForm.adsTableAppts do
    begin

  First;
  for I := 1 to RecordCount  do
    begin
      DecodeDate(FieldByName('DateAppt').AsDateTime, tempYear, tempMonth, tempDay);
      DecodeTime(FieldByName('StartTime').AsDateTime, tempHour, tempMin, tempSec,tempMilliSec);

      tempDateTime := EncodeDateTime(tempYear, tempMonth, tempDay, tempHour, tempMin, tempSec, 
tempMilliSec);
      Edit;
      FieldByName('DayStartTime').AsDateTime := tempDateTime;
      Post;

showmessage('DateAppt = ' + FieldByName('DateAppt').AsString + #13 +

        'DayStartTime ' + #13 +
        'tempYear = ' + FloatToStr(tempYear) + #13 +
        'tempMonth = ' + FloatToStr(tempMonth) + #13 +
        'tempDay = ' + FloatToStr(tempDay) + #13 + #13 +

        'tempHour = ' + FloatToStr(tempHour) + #13 +
        'tempMin = ' + FloatToStr(tempMin) + #13 +
        'tempSec = ' + FloatToStr(tempSec) + #13 +
        'tempMilliSec = ' + FloatToStr(tempMilliSec) + #13 + #13 +

        'tempDateTime  Day = ' + DateToStr(tempDateTime) + #13 +
        'tempDateTime  Time = ' + TimeToStr(tempDateTime) + #13 + #13 +

        'DayStartTime - Day = ' + DateToStr(FieldByName('DayStartTime').AsDateTime) + #13 +
        'DayStartTime - Time = ' + TimeToStr(FieldByName('DayStartTime').AsDateTime));

............ etc

Suggestions ???

TIA

John

asked 05 Dec '15, 08:06

JohnR's gravatar image

JohnR
31334
accept rate: 0%

edited 06 Dec '15, 14:41

Joachim%20Duerr's gravatar image

Joachim Duerr
8.7k1031133

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×271

Asked: 05 Dec '15, 08:06

Seen: 1,364 times

Last updated: 06 Dec '15, 14:41

Advantage Developer Zone Contact Us Privacy Policy Copyright Info


Powered by Advantage Database Server and OSQA
Disclaimer: Opinions expressed here are those of the poster and do not necessarily reflect the views of the company.