Article ID: 167186
Article Last Modified on 2/16/2005
*** Begin code ***
ON KEY LABEL f2 CLEAR EVENTS
ON KEY LABEL f3 DO refresh
SET CENTURY to 19 ROLLOVER 60
SET CENTURY off
dateform=CREATEOBJECT('form')
WITH dateform
.width=300
.height=65
.ADDOBJECT('text1','textbox')
WITH .text1
.format='K'
.inputmask='99/99/99'
.left=1
.top=10
.width=60
.value=DTOC(date())
.visible=.t.
ENDWITH && text1
.ADDOBJECT('label1','label')
WITH .label1
.top=50
.left=90
.width=120
.fontbold=.t.
.caption="Press <F2> to exit form"
.visible=.t.
ENDWITH && label1
.ADDOBJECT('label2','label')
WITH .label2
.caption="Year of date shown is "+ ;
ALLTRIM(STR(YEAR(CTOD(dateform.text1.value))))
.top=32
.left=10
.width=160
.fontbold=.t.
.visible=.t.
ENDWITH && label2
.ADDOBJECT('label3','label')
WITH .label3
.caption='Press <f3> to refresh after entering new date'
.top=10
.left=65
.width=250
.fontbold=.t.
.visible=.t.
ENDWITH && label3
.show
ENDWITH && dateform
READ EVENTS
ON KEY LABEL f2
ON KEY LABEL f3
PROCEDURE refresh
dateform.label2.caption="Year of date shown is: "+ ;
ALLTRIM(STR(YEAR(CTOD(dateform.text1.value))))
dateform.refresh
RETURN
*** End code ***
SET CENTURY to 19 ROLLOVER 60This means that when a two-digit value for a year "60" and greater falls within the 21st century, two-digit values less than 60 fall into the 20th century.
*** Begin code ***
ON KEY LABEL f2 CLEAR EVENTS
SET CENTURY to 19 ROLLOVER 60
SET CENTURY off
dateform=CREATEOBJECT('form')
WITH dateform
.width=120
.height=65
.ADDOBJECT('text1','textbox')
WITH .text1
.format='K'
.left=35
.top=10
.width=75
.value=date()
.visible=.t.
ENDWITH && text1
.ADDOBJECT('label1','label')
WITH .label1
.top=35
.left=1
.width=120
.fontbold=.t.
.caption="Press <F2> to exit form"
.visible=.t.
ENDWITH && label1
.show
ENDWITH && dateform
READ EVENTS
ON KEY LABEL f2
*** End code ***
Keywords: kbprogramming kbprb KB167186