Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add time to date to make DateTime
Message
From
02/02/2017 19:33:25
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01647380
Message ID:
01647389
Views:
29
>>>Hi,
>>>
>>>Say I have a variable that contains a date. I want to add to it the current time and make the value DateTime type.
>>>How do you do it? TIA
>>
>>
>>m.Yesterday = DATE() - 1
>>? VARTYPE(m.yesterday),m.yesterday
>>m.yesterday = DTOT(m.yesterday) + SECONDS()
>>? VARTYPE(m.yesterday),m.yesterday
>>
>
>First, thank you. Something is not working for me. Let me clarify. I want the value of (your example, m.Yesterday) to be converted to the DateTime that has the current time. For example, I want the variable to have:
>tYesterday = '2017-01-31 18:49:111'
>
>If you see my message to myself hopefully you will see what I mean.

Hm... the important is that you have a solution that works for you, but, for the record, I think that what I suggested does what you was looking for, and it is not affected by VFP settings.
LOCAL Yesterday

m.Yesterday = DATE() - 1

SET DATE ANSI
? CTOT(DTOC(m.Yesterday) + ' ' + TIME()), DTOT(m.Yesterday) + SECONDS()

SET DATE LONG
? CTOT(DTOC(m.Yesterday) + ' ' + TIME()), DTOT(m.Yesterday) + SECONDS()
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform