Inserta DIA / MES / AÑO y HORA actual en cualquier programa que lo necesite para su cabecera
DATE Returns the current date to the X register. In MDY mode, the date is returned as MM.DDYYYY; in DMY mode, it is returned as DD.MMYYYY; and in YMD mode, it is returned as YYYY.MMDD.
TIME Devuelve la hora actual en el registro X. La hora se devuelve en formato HH.MMSSss, con HH de 0 a 23, independientemente de la configuración CLK12/CLK24. Además, cuando se ejecuta desde el teclado, muestra la hora en formato "HH:MM:SS AM" o "HH:MM:SS", cuando el formato de visualización es CLK12 o CLK24, respectivamente.
Ajustamos (FIX) a 0 y eliminamos los decimales (IP) para obtener el numero entero
DMY DATE = DIA
MDY DATE = MES
YMD DATE = AÑO
TIME retorna la HORA
30/07/2023 10.42
00 { 539-Byte Prgm }
01▸LBL "MENSU"
02 " "
03 ADV
04 FIX 00
05 CLA
06 CLRG
07 MDY
08 DATE
09 IP
10 STO 20 "Mes"
11 YMD
12 DATE
13 STO 21 "Año"
14 DMY
15 DATE
16 STO 23 "Dia"
17 CLA
18 ARCL 23
19 ├" / "
20 ARCL 20 "Mes"
21 ├" / "
22 ARCL 21
23 ├" "
24 FIX 02
25 TIME "Hora"
26 ARCL ST X
27 AVIEW
28 END
Con el mes en Letra
'- Variable Declaration Section - '-------------------------------- DIM MonthName$(12) ' array storing the names of the months DIM Hours% ' numeric value of hour DIM Month% ' numeric value of month DIM Day% ' numeric value of day DIM Year% ' numeric value of year DIM Suffix$ ' day suffix DIM AmPm$ ' AM or PM '---------------------------- '- Main Program Begins Here - '---------------------------- MonthName$(1) = "January" ' store the month names MonthName$(2) = "February" MonthName$(3) = "March" MonthName$(4) = "April" MonthName$(5) = "May" MonthName$(6) = "June" MonthName$(7) = "July" MonthName$(8) = "August" MonthName$(9) = "September" MonthName$(10) = "October" MonthName$(11) = "November" MonthName$(12) = "December" DO ' begin main loop Month% = VAL(LEFT$(DATE$, 2)) ' extract value of month Day% = VAL(MID$(DATE$, 4, 2)) ' extract value of day Year% = VAL(RIGHT$(DATE$, 4)) ' extract value of year Hours% = VAL(LEFT$(TIME$, 2)) ' extract value of hours IF Hours% > 12 THEN ' military time? Hours% = Hours% - 12 ' yes, convert to civilian AmPm$ = "PM" ' it's the afternoon ELSE ' no AmPm$ = "AM" ' it's the morning END IF IF Day% = 1 OR Day% = 21 OR Day% = 31 THEN ' one of these days? Suffix$ = "st," ' yes, day ends in st ELSEIF Day% = 2 OR Day% = 22 THEN ' no, one of these days? Suffix$ = "nd," ' yes, day ends in nd ELSEIF Day% = 3 OR Day% = 23 THEN ' no, one of these days? Suffix$ = "rd," ' yes, days ends in rd ELSE ' no Suffix$ = "th," ' day must end in th then END IF LOCATE 2, 2 ' position cursor Dt$ = "The current date is " + MonthName$(Month%) ' build new date string Dt$ = Dt$ + STR$(Day%) + Suffix$ + STR$(Year%) + " " PRINT Dt$ ' display date string LOCATE 4, 2 ' position cursor Tm$ = "The current time is " + RIGHT$("0" + LTRIM$(STR$(Hours%)), 2) ' build new time string Tm$ = Tm$ + " Hours, " + MID$(TIME$, 4, 2) + " Minutes and " Tm$ = Tm$ + RIGHT$(TIME$, 2) + " Seconds " + AmPm$ PRINT Tm$ ' display time string LOOP UNTIL INKEY$ <> "" ' end loop if key pressed SYSTEM ' return to Windows