English
Source / code snippets

date Long Save Variable

 

Stefan
Schnell
Hello Community,
enclosed The Possibility the Speicherung one Datums in a Long-variables, with some functions and Procedures:
CompileMarkSeparation
-Begin-----------------------------------------------------------------
-Datum-Funktionen----------------------------------------------------
Declare Datum#
Dim Datum#, 8
-Konstanten--------------------------------------------------------
Def &Day 0
Def &Month 2
Def &Year 4
-Tag---------------------------------------------------------------

Proc getDay

    Return @Byte(Datum#, &Day)

EndProc

Proc setDay

    Parameters Day&

    If Day& > 0 And Day& < 32

        Byte Datum#, &Day = Day&

    EndIf

EndProc

-Monat-------------------------------------------------------------

Proc getMonth

    Return @Byte(Datum#, &Month)

EndProc

Proc setMonth

    Parameters Month&

    If Month& > 0 And Month& < 13

        Byte Datum#, &Month = Month&

    EndIf

EndProc

-Jahr--------------------------------------------------------------

Proc getYear

    Return @Word(Datum#, &Year)

EndProc

Proc setYear

    Parameters Year&

    If Year& > -32769 And Year& < 32768

        Word Datum#, &Year = Year&

    EndIf

EndProc

-Datum-------------------------------------------------------------

Proc getDate

    Return @Str$(getDay()) + . + @Str$(getMonth()) + . +
    @Str$(getYear())

EndProc

Proc setDate

    Parameters Day&, Month&, Year&
    setDay(Day&)
    setMonth(Month&)
    setYear(Year&)

EndProc

-End---------------------------------------------------------------s2>----

around the date properly of/ one data base use to heard the year to in front, this might (have I do not tested) through following Änderung To achieve his:
CompileMarkSeparation
-Konstanten--------------------------------------------------------
Def &Day 6
Def &Month 4
Def &Year 0

plenty Fun at program.
Greeting
Stefan
 
04/14/05  
 




p.specht
15 years later a Version for XProfan-11.2 free. Thanks the Date-function really antiquated, but here would zB The Sortierreihenfolge spare wählbar:
cls
Declare date#:Dim date#,8 : Def &Year 0 : Def &Month 4 : Def &Day 6
:Proc getDay :Return byte(date#,&Day):ENDPROC
:Proc setDay :Parameters Day&:case (Day&>0) And (Day&<32):byte date#,&Day=Day&:ENDPROC
:Proc getMonth :Return byte(date#,&Month):ENDPROC
:Proc setMonth :Parameters Month&:case (Month&>0) And (Month&<13):byte date#,&Month=Month&:ENDPROC
:Proc getYear :Return Word(date#,&Year):ENDPROC
:Proc setYear :Parameters Year&:case (Year&>-32769) And (Year&<32768):Word date#,&Year=Year&:ENDPROC
:Proc getDate :Return Str $(getDay())+"."+Str $(getMonth())+"."+Str $(getYear()):ENDPROC
:Proc setDate :Parameters Day&,Month&,Year&:setDay(Day&):setMonth(Month&):setYear(Year&):ENDPROC
SetDate(32,13,-32769)
print date#
print getdate()
waitinput
 
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen...
02/02/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

2.410 Views

Untitledvor 0 min.
Ernst vor 6 Tagen
p.specht vor 8 Tagen
Roland Schäffer vor 31 Tagen
Uwe Lang03/04/21
More...

Themeninformationen

this Topic has 2 subscriber:

p.specht (1x)
Stefan Schnell (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie