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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating a date

Status
Not open for further replies.

Samalia

Technical User
Jun 7, 2005
46
CA
I have three different parameters and I want to combine them into one. I want to create a date field from the day, month and year parameters. I've tried some code, adding the parameters together, storing them to another parameter but it ends up blank. I dont get it.

This is what I've got so far:

date = "str(lmonth) + lday + lyear"

WAIT WINDOW TRANSFORM(date)
 
Hi Samalia,

Try
date = DATE([nYear, nMonth, nDay])

Regards,

Mike
 
Samalia/Mike,

I think you will need to leave out the square brackets. The parameters used in the function DATE() have to be numeric.

For example:

ny=2005
nm=6
nd=24
?DATE(ny,nm,nd) && this returns 24/06/2005, variable type Date.



Hope that helps,

Stewart
PS If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Stewart,

The example I provided was cut and paste from VFP8 help.

Regards,

Mike
 
Hi Mike,

Oh yes, I'd forgotten.

In this case the brackets mean that the year, month & day parameters are optional. I assumed when I read your posting, that you were indicating that they should be included when using the function, sorry about that.

Stewart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top