Subtracting data type: Datetime

Results 1 to 2 of 2

Thread: Subtracting data type: Datetime

  1. #1
    Join Date
    Dec 1969

    Default Subtracting data type: Datetime

    Looking for syntax to try and find the amount of time between two records with a field of data type: datetime.<BR><BR>Here is what the fields look like in the DB:<BR><BR>EXAMPLE<BR>Record 1: 7/1/2002 11:17:00 AM<BR>Recotd 2: 7/1/2002 11:17:21 AM<BR><BR>RESULTS would look like: 00:00:21 AM<BR><BR>I’m assuming I would first have to LTRIM and RTRIM somehow.<BR>Any Ideas.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Subtracting data type: Datetime

    Why the leading zeros and AM and not only 21 (seconds)? <BR><BR>Use the datediff function.<BR><BR>d = datediff("s",cdate(record1),cdate(record2))<BR><BR >OT: Records do not have the format in DB if the datatype is datetime. Datetime values are stored as numbers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts