Anmelden

View Full Version : Systemdatum nach String



codierknecht
03-07-06, 09:03
Hallo Forum,

ich möchte das Systemdatum im Free RPG in einen String wandeln. Das Ergebnis soll JJJJMMTT ohne Trennzeichen sein. Ich finde aber nur Funktionen, um einen numerischen oder Alphawert in ein Datum zu wandeln.

Wer hat die Lösung?

kuempi von stein
03-07-06, 09:19
mhh... hab isch noch nich gemacht nicht, aber laut Handbuch! (chapter 20 seite 407) soll das so gehen..



/FREE
D_10 = %DATE (CHR_8a: *YMD);
//
// Move the 10-character date to an 8-character field CHR_8b.
// It will contain the date that was just moved to D_10, but with
// a 2-digit year and the default separator indicated by the *YMD
// format.
//
CHR_8b = %CHAR (D_10: *YMD);
//
// Move the 10-character date to an 8-character date D_8a.
// It will contain the date that * was just moved to D_10, but
// with a 2-digit year and a . separator since D_8a was defined
// with the (*YMD.) format.
//
D_8a = D_10;
//
// Move the 8-character date to a 10-character date D_10
// It will contain the date that * D_8b was initialized to,
// but with a 4-digit year, 1995-07-31.
//
D_10 = D_8b;
//
// After the last move, the fields will contain
// CHR_8b: 95/05/21
// D_8a: 95.05.21
// D_10: 1995-07-31
//
*INLR = *ON;
/END-FREE


geht bestimmt aber auch einfacher?
gruss kuempi

Fuerchau
03-07-06, 09:37
*YMD0 ist dann auch ohne Trennzeichen.

Also:
MyDate = %char(%date():*YMD0);

B.Hauser
03-07-06, 13:01
*YMD hat nur ein 2-stelliges Jahr.
Wird ein 4-stelliges Jahr benötigt, ist *ISO erforderlich.

Birgitta

Fuerchau
03-07-06, 14:59
*CYMD0 heißt hier das Zauberwort.

Juergen
03-07-06, 15:25
So gehts:
MyDate = %char(%date():*ISO0);

*CYMD liefert nur 1060704 (1 für'S Jahrhundert)