| Subject |
Re: DMY() |
| From |
Ken Mayer <dbase@nospam.goldenstag.net> |
| Date |
Sat, 29 Aug 2020 09:53:16 -0700 |
| Newsgroups |
dbase.getting-started |
On 8/29/2020 9:18 AM, gilbert beverhoud wrote:
> How can I write DMY() in this program to make the field Fecha as
> Aug 29 2020 and not as 08/29/2020 . The examples in Ken Mayer book don't give an easy example.
> Thansk very much If I can get an anwer to this problem.
Take a good look at the dUFLP (freeware library of code), and
specifically DateEx.cc:
This function:
FUNCTION DateText( dDate )
/*
-------------------------------------------------------------
Programmer..: Miriam Liskin
Date........: 09/25/1994
Notes.......: Display date in format Month day, year (e.g.,
July 1, 1991)
Written for.: dBASE IV, 1.1
Rev. History: 05/23/1991 -- Original
Fall, 1994 -- revised for dBASE 5.0 for
Windows. Jay Parsons
11/02/1996 -- Tinkered with minimally to
make part of custom class.
Ken Mayer
Calls.......: None
Usage.......: dateex.DateText(<dDate>)
Example.....: ? dMyDate.DateText(date())
Returns.....: July 1, 1991
Parameters..: dDate = date to be converted
-------------------------------------------------------------
*/
RETURN ( cmonth(dDate) +" "+ltrim(str(day(dDate),2))+", "+;
str(year(dDate) ,4) )
// -- EoM: DateText
Could be altered to use the first three letters of the month:
RETURN ( left(cmonth(dDate),3) +" "+ltrim(str(day(dDate),2))+", "+;
str(year(dDate) ,4) )
(Note addition of use of the left function around cMonth ...)
However, I don't suggest altering the code in the dUFLP but creating
your own version, just copy what is here and put it in your own library
of code, for example. Calling it might be as simple as:
set proc to MyDates.cc
? dateText( my_date )
where my_date would be whatever date value you needed.
Ken
--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
|
|