Message
From
29/10/2016 07:41:29
 
 
To
28/10/2016 10:34:06
Antonio Lopes (Online)
BookMARC
Coimbra, Portugal
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01642436
Message ID:
01642460
Views:
75
>>>>I have 2 datetime fields
>>>>
>>>>The first contains a date only
>>>>
>>>>The second contains a date and time - the date is wrong but the time is correct
>>>>
>>>>How do I add the time portion of field 2 to field 1
>>>>
>>>>field 1 date 28/10/2016 00:00:00 I need this field to be 28/10/2016 14:31:00
>>>>
>>>>field2 date 30/12/1899 14:31:00
>>>>
>>>>How can I do this?
>>>
>>>
>>>REPLACE field1 WITH field1 + (field2 - TTOD(field2))
>>>
>>
>>My code is
>>REPLACE e WITH e + (i - TTOD(i)) where e is field 1 and i is field 2
>>
>>I am getting operator/operand type mismatch
>>
>>Both fields are date time
>>
>>Thanks for your help so far
>>
>>Colin
>
>Not trying to correct Tamar's reply (wouldn't dare!) but that would be
>
>
>REPLACE e WITH e + (i - DTOT(TTOD(i)))
>
Good catch. I've been playing a lot with dates and times in SQL Server recently, and there the type would get coerced. Forgot that VFP wouldn't do that.

Tamar
Previous
Reply
Map
View