gibaf Posted July 3, 2015 Report Share Posted July 3, 2015 ola a todos ! agradeco a quem me ajudar: muito obrigado Ronaldbuch 1 Quote Link to comment Share on other sites More sharing options...
Ariston Santos Posted July 3, 2015 Report Share Posted July 3, 2015 Amigo, As datas gravadas em banco de dados relacional geralmente são no formato UTC. Se for este seu caso, a função abaixo resolve: FUNCTION UTCtoDh(cDate, lHora) LOCAL cDtHo := SUBSTR(cDate,9,2)+"/"+SUBSTR(cDate,6,2)+"/"+SUBSTR(cDate,1,4)+IIF(lHora,", "+SUBSTR(cDate,12,5),"") RETURN(cDtHo) Quote Link to comment Share on other sites More sharing options...
gibaf Posted July 6, 2015 Author Report Share Posted July 6, 2015 Amigo, As datas gravadas em banco de dados relacional geralmente são no formato UTC. Se for este seu caso, a função abaixo resolve: FUNCTION UTCtoDh(cDate, lHora) LOCAL cDtHo := SUBSTR(cDate,9,2)+"/"+SUBSTR(cDate,6,2)+"/"+SUBSTR(cDate,1,4)+IIF(lHora,", "+SUBSTR(cDate,12,5),"") RETURN(cDtHo) ola fiz a sua dica... mas o substr "estoura" a app, tipo, dah aquela mensagem do windows q a app parou de funcionar... dei alert no valtype(cDate) e mostrou T (Timestamp)... agora, alert no SUBSTR(cDate,9,2), ou qquer outra funcao,tipo, CStr(), ValToPrg(), TtoC(), TtoS(), tambem "estoura" a app... se alguem mais tiver mais alguma outra dica, fico muito agradecido.... Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 6, 2015 Report Share Posted July 6, 2015 // NOVO NA CLASSE 3.10 By Gilmer - 20/10/2014 Function TimeZone(dData) Local cDateTimeZone,aTimeStamp,cTzd Default dData:=Date() aTimeStamp:=hb_atokens(tip_timestamp(dData)," ") cTzd:=aTail(aTimeStamp) cTzd:=Left(cTzd,Len(cTzd)-2)+":"+Right(cTzd,2) cDateTimeZone:=StrZero(Year(dData),4)+"-"+StrZero(Month(dData),2)+"-"+StrZero(Day(dData),2)+"T"+Time()+cTzd Return(cDateTimeZone) Quote Link to comment Share on other sites More sharing options...
gibaf Posted July 6, 2015 Author Report Share Posted July 6, 2015 // NOVO NA CLASSE 3.10 By Gilmer - 20/10/2014 Function TimeZone(dData) Local cDateTimeZone,aTimeStamp,cTzd Default dData:=Date() aTimeStamp:=hb_atokens(tip_timestamp(dData)," ") cTzd:=aTail(aTimeStamp) cTzd:=Left(cTzd,Len(cTzd)-2)+":"+Right(cTzd,2) cDateTimeZone:=StrZero(Year(dData),4)+"-"+StrZero(Month(dData),2)+"-"+StrZero(Day(dData),2)+"T"+Time()+cTzd Return(cDateTimeZone) ola... nao deu certo... nao sei pq, mas, penso q deva ser pq o q eh recebido no parametro dData nao eh (na minha necessidade) um campo Date, mas sim Timestamp... mas, na tentativa de usar a sua dica, gostaria dizer, o resultado q deu: na linha: aTimeStamp := hb_atokens(tip_timestamp(dData)," ") //retorna -3 e na linha: cTzd := aTail(aTimeStamp) //"estoura" a app e agora ??? hehehe Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 6, 2015 Report Share Posted July 6, 2015 O UTC é -3 mesmo(Brasilia). Não sei porque estoura a sua app. Que usas Harbour ou xHarbour? Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 6, 2015 Report Share Posted July 6, 2015 https://www.mail-archive.com/harbour@harbour-project.org/msg11622.html test->tstamp := datetime() // or any other datetime variable // for testing, check msginfo( ttoc( test->tstamp ) ) Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 6, 2015 Report Share Posted July 6, 2015 MyTable->MyTimeStamp := DateTime() MyTable->MyTimeStamp := DtoC(Date()) + " " + Time() MyTable->MyTimeStamp := TtoS(DateTime()) MyTable->MyTimeStamp := TtoC(DateTime()) Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 6, 2015 Report Share Posted July 6, 2015 http://compgroups.net/comp.lang.xharbour/assigning-value-to-adt-timestamp-field/360365 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted July 6, 2015 Report Share Posted July 6, 2015 http://www.devmedia.com.br/forum/timestamp-firebird/366200 Quote Link to comment Share on other sites More sharing options...
gibaf Posted July 7, 2015 Author Report Share Posted July 7, 2015 MyTable->MyTimeStamp := DateTime() MyTable->MyTimeStamp := DtoC(Date()) + " " + Time() MyTable->MyTimeStamp := TtoS(DateTime()) MyTable->MyTimeStamp := TtoC(DateTime()) ola... como disse a segunda resposta: os comandos/funcoes DtoC, TtoS, Ttoc, SubStr, etc, "estoura" a app... o meu problema eh quando o campo eh Timestamp e nao DataTime (sao sei se tem diferenca... penso q sim - hehehe) aaa... obrigado pela ajuda Quote Link to comment Share on other sites More sharing options...
oliveiros Posted July 8, 2015 Report Share Posted July 8, 2015 Olá, Alguém sabe informar se tem alguma classe nativa para usar o FIREBIRD sem ODBC? Desde já agradeço a atenção. Oliveiros Junior Quote Link to comment Share on other sites More sharing options...
gibaf Posted July 9, 2015 Author Report Share Posted July 9, 2015 Olá, Alguém sabe informar se tem alguma classe nativa para usar o FIREBIRD sem ODBC? Desde já agradeço a atenção. Oliveiros Junior ola.. SQLRDD (comercial) faz acesso nos bancos: 1) Nativo: Oracle, MySQL, Firebird 2) ODBC: Microsoft SQL Server, Oracle, DB2, MySQL, Postgress, Firebird, Ingres R3, Sybase System XI, XII and Adaptive Server, ADABAS-D, Caché Quote Link to comment Share on other sites More sharing options...
oliveiros Posted July 14, 2015 Report Share Posted July 14, 2015 Olá, Desculpas pela demora. Muito obrigado pela resposta. Att., Oliveiros Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.