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!

Possible bug with DATE()? 1

Status
Not open for further replies.

ChrisRChamberlain

Programmer
Mar 23, 2000
3,392
GB
Hi all

Using either Win 2k or XP and
Code:
[COLOR=blue]SET DATE TAIWAN
? DATE()
? DTOS(DATE())[/color blue]
yields year '95 for DATE() whilst DTOS(DATE()) value is correct.

If this is a known bug, apologies for wasting everyone's time, otherwise can anyone else confirm the behaviour?

TIA

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.com
 
Fails in VFP8 also!

I like work. It fascinates me. I can sit and look at it for hours...
 

VFP 6, Windows XP:

Code:
SET DATE TAIWAN
? DATE()          && gives {0095/02/21}
? DTOS(DATE())    && gives "20060221"
? DTOC(DATE())    && gives "0095/02/21"
? DTOC(DATE(), 1) && gives "20060221"
 
Hi,

I would say DATE() is correct. The link provided by Stella740pl says:
*** Note : Year 2000 is equivalent to Taiwan Year 0089

This other link from MS says:

The date January 1, 2001 A.D. in the Gregorian calendar is equivalent to the first day of January in the year 90 of the current era in the Taiwan Calendar.
[tt]
2000 = 0089
2001 = 0090
...
2005 = 0094
2006 = 0095[/tt]

but I don't know about DTOS().
 
Code:
DTOS() is supposed to return everytime the same strinhg no metter what the current SET DATE is. SO no metter what you set SET CENTURY OFF SET DATE GERMAN/TAIWAN etc it supposed to return always 20060220 :-)

Borislav Borissov
 

So this turns up to be correct/intended behavior AND 95 is the correct year?
Interesting.
I've learned something new today.


 
That's why I am member of this and several ones forums, to learn something and every day I am :).
For example I program with VFP for almost 18 years and last month I learned that CommandGroup has VALUE property
:))))))))))))))))))
Shame of me :eek:)

Borislav Borissov
 

Borislav,

I program with VFP for almost 18 years

That's an excellent achievement, given that the product only appeared in 1995. (Sorry, Borislav, I couldn't resist that. I know you really meant to say FoxPro (FoxBase?), not VFP.)

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks Chis, I didn't know anything about wareki era or regnal years, untill Stella740pl gave us the clue. I was looking for additional information and this is what I found:
Wikipedia said:
Traditional Chinese years were not continuously numbered in the way that the BC/AD system is. More commonly, official year counting always used some form of a regnal year. This system began in 841 BC during the Zhou dynasty. Prior to this, years were not marked at all, and historical events cannot be dated exactly.

In 841 BC, the Li King Hu of Zhou was ousted by a civilian uprising, and the country was governed for the next fourteen years by a council of senior ministers, a period known as the Regency. In this period, years were marked as First (second, third, etc) Year of the Regency.

Subsequently, years were marked as regnal years, e.g. the year 825 BC was marked as the 3rd Year of the Xuan King Jing of Zhou. This system was used until early in the Han dynasty, when the Wen Emperor of Han instituted regnal names. After this, most emperors used one or more regnal names to mark their reign. Usually, the emperor would institute a new name upon accession to the throne, and then change to new names to mark significant events, or to end a perceived cycle of bad luck. In the Ming and Qing dynasties, however, each emperor usually used only one regnal name for their reign.

This sytem continued until the Republic of China, which counted years as Years of the Republic, beginning in 1912. Thus, 1912 is the 1st Year of the Republic, and 1948 the 37th. This system is still used for official purposes in Taiwan. For the rest of China, in 1949 the People's Republic of China chose to use the Common Era system (equivalently, AD/BC system), in line with international standards.
 
Mike :)
Sure, it can't be. My calculations was wrong :)
(or I am feeling older than I am :)
I started with CLIPPER and then VFP 5,6,8 and now 9 :eek:)
So maybe not 18 years but maybe 10. I can't remeber when I started?

Borislav Borissov
 

I came across similar issues while working on a project in Thailand some years ago.

If I remember right, the years there are based on the Buddhist era, and so were 543 years earlier than our AD years. But before 1941, the year started on 1 April rather than 1 Janauary, and this required another adjustment.

I also vaguely remember that, for some purposes, we had to use a regnal year, that is, the year within the current king's reign. The year I was there was something like the 25th year of Bhumibol.

All the above is based on my failing memory, so I don't guarantee it's correct.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 

I didn't know anything about wareki era or regnal years, untill Stella740pl gave us the clue.

Well, the upsetting thing is, I didn't notice this clue in the article even after I found it myself and posted the link, until TheRambler pointed out to this. I must admit, I didn't read the whole thing, I didn't have the time, I just glanced over it, found it relevant, and posted the link.

Clipper? Same here (and some FoxBase and dBaseIII+).
 
Since we are ramblin here, i started with DBaseII on Dec Rainbow with CP/M and managed to get Foxbase to run on the first version of Dos for the forgotten DEC computer
I guess that makes me OOOOLLLLDDDD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top