Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding time drom a datetime field to another fild
Message
 
To
28/10/2016 10:34:06
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01642436
Message ID:
01642443
Views:
42
>>>>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)))
>
>
>Now, if this data comes from the same Excel file that you mentioned in a recent thread, and if your Excel columns register separately the date and the time of an event, and if you're interested only in the final datetime representation of the event, you can calculate the value without going through this intermediary step, by adding the involved columns at front (if you're getting a column value of 30/12/1899 14:31:00, it's probably because you're transforming a time Excel value into a VFP datetime value).
>
>Hope that this makes sense...

Antonio

You are a genius

It all works beautifully

Thanks a lot
Specialist in Advertising, Marketing, especially Direct Marketing

I run courses in Business Management and Marketing
Previous
Reply
Map
View

Click here to load this message in the networking platform