Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP String Builder 1

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
Hi. I'm trying to build a simple string in VFP, and I'm receiving the error "Operator/Operand type mismatch". Here's what I'm doing...
Code:
MSG = "Note: This item is deleted as of " + DATETIME() + "."
It's seems pretty simple, but I can't figure out what I'm doing wrong :(

Thanks.
 

You are not convertind DateTime data type to string. Try to use TTOC(DATETIME())
 
That's what I was missing...Thanks!
 
Stella,

One more question if you don't mind...

Is there a way that TTOC can be formatted to display date only? I checked the MSDN article on this function, but found their description rather obscure.

Thanks again
 

Yes, TTOD(), and in your case you should convert it, also, as it creates a Date type, not Character. You can do it like this:

DTOC(TTOD(DATETIME()))
 

Or, if you don't need the time portion of DATETIME() at all, just use DTOC(DATE()) instead.
 
You can also use TRANSFORM() in this situation, so you don't have to think about what type you're starting with:

TRANSFORM(DATE())

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top