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

Problem with a Function

Status
Not open for further replies.

Collin79

Programmer
Dec 31, 2000
31
MX
Hi!!

I'm using the next code line to do a reference number:

thisform.txtsiglascomp.value + "6" + LTRIM(STR(thisform.text4.value)) + LTRIM(STR(Month(Date()))) + LTRIM(STR(Year(Date())))


It works Ok, but I need the value of the month and year will be of 2 digits (year 2001 I need 01 and Month 1 need 01)

Is there a way to give format to year and month?

Please Help me!!!
 
Another is to use the DTOS() function:

month=substr(dtos(date()),5,2)
year=substr(dtos(date()),3,2) Jon Hawkins
jonscott8@yahoo.com

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
Hello,

Maybe this isn't what you want, but I'll try my 0.2c:

If the result is used as a date datatype, you don't need the formatting at all. VFP doesn't need a straight date format. i.e: {1/1/00} is interpreted succesfully as {01/01.2000}.

I hope that you'll find this information useful for you.
 
Hi guys!!!

Thanks to everybody, I really appreciate your help, it was so clear.

Regards

Collin79
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top