PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 22 → WX - Utilitário for Boller para Converte Data T Hota para DataHora, Extrai Data e Extrai Hora
WX - Utilitário for Boller para Converte Data T Hota para DataHora, Extrai Data e Extrai Hora
Débuté par BOLLER, 16 mar. 2018 10:23 - Aucune réponse
Membre enregistré
2 852 messages
Popularité : +89 (91 votes)
Posté le 16 mars 2018 - 10:23
Procedure ConverteDataTHora2DataHora(DataHoraTipoT)

//1234567890123456789
//2019-01-09T00:00:00
sNovaData is string

IF Middle(DataHoraTipoT,11,1)="T"
sNovaData = Middle(DataHoraTipoT,1,4)+Middle(DataHoraTipoT,6,2)+Middle(DataHoraTipoT,10,2)+Middle(DataHoraTipoT,12,2)+Middle(DataHoraTipoT,15,2)+Middle(DataHoraTipoT,18,2)
END

RESULT(sNovaData)



Procedure ExtraiDataHora2Data(DataHora)

sNovaData is string

IF Middle(DataHora,5,1) = "-" OR Middle(DataHora,5,1) = "/" OR Middle(DataHora,5,1) = "."
//1234567890123456789
//2019-01-0900:00:00
sNovaData = Middle(DataHora,1,4)+Middle(DataHora,6,2)+Middle(DataHora,10,2)
ELSE
//1234567890123456789
//20190109125030
sNovaData = Middle(DataHora,1,4)+Middle(DataHora,5,2)+Middle(DataHora,7,2)
END

RESULT(sNovaData)



Procedure ExtraiDataHora2Hora(DataHora)

sNovaHora is string

IF Middle(DataHora,5,1) = "-" OR Middle(DataHora,5,1) = "/" OR Middle(DataHora,5,1) = "." OR Middle(DataHora,13,1) = ":"
//1234567890123456789
//2019-01-0900:00:00
sNovaHora = Middle(DataHora,11,2)+Middle(DataHora,14,2)+Middle(DataHora,17,2)
ELSE
//1234567890123456789
//20190109125030
sNovaHora = Middle(DataHora,9,2)+Middle(DataHora,11,2)+Middle(DataHora,13,2)
END

RESULT(sNovaHora)


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/