Dear users
Is it possible to convert decimal numbers to time (hours and minutes)
p.e. each time 10 minutes more
if 18.00 = 18.00 h
then 18.10 = 18.10 h
...
18.60 = 19.00 h
18.70 = 19.10 h
...
18.90 = 19.30 h
Is that possible because I do not see how to count minutes more without doing it with numbers
Thank you
José (local food bank to invite the users of the food bank on a different time)
convert decimal numbers to hours/minute
Re: convert decimal numbers to hours/minute
to make date cards for the whole year with for each date a different hour/minute
Re: convert decimal numbers to hours/minute
Whit the help of saint ChatGPT
Regards,
Code: Select all | Expand
#include "FiveWin.ch"
Function Main()
LOCAL nHora := 18, nInc := 0.10, i
LOCAL nHoras, nMinutos, ahoras := {}
// Ciclo para agregar 10 minutos en cada iteración
FOR i := 1 TO 40
// Extraemos la parte entera (hora) y decimal (minutos)
nHoras := INT(nHora)
nMinutos := (nHora - nHoras) * 100
// Agregamos 10 minutos
nMinutos += 10
// Si los minutos exceden 60, sumamos 1 hora y ajustamos los minutos
IF nMinutos >= 60
nHoras += 1
nMinutos -= 60
ENDIF
// Control para las 24:00 horas, reinicia a 00:00
IF nHoras >= 24
nHoras := 0
ENDIF
// Reasignamos el valor de nHora en formato numérico
nHora := nHoras + (nMinutos / 100)
// Mostramos el nuevo valor de la hora
AADD(aHoras, { i, nHora} )
NEXT
xBrowse(aHoras)
Return NIL
Saludos,
Carlos Gallego
*** FWH-24.07, xHarbour 1.3.1 Build 20240624, Borland C++7.70, PellesC ***
Carlos Gallego
*** FWH-24.07, xHarbour 1.3.1 Build 20240624, Borland C++7.70, PellesC ***
Re: convert decimal numbers to hours/minute
Gracias Carlos por su ayuda !