Pessoal
Alguma funcao que retorne a timezone no harbour ?
Quando chega horario de verao, pessoal que usa NFe Cte tem que indicar a time zone em varios lugares
<dhEvento>2016-10-31T09:44:20-02:00</dhEvento>
Obrigado

Moderador: Moderadores
cDateTime := TtoC( DateTime() )
cDateTime := Left( cDateTime, RAt( ".", cDateTime ) -1 )
pessoal que usa NFe Cte tem que indicar a time zone em varios lugares
PROCEDURE Main
? DateTimeXml( Date(), Time(), "SP", .T. )
d:\temp>test
2017-09-03T14:49:32-03:00
Ok. Acho que o único jeito é pela Consulta do Status Operacional. Veja um exemplo entre SP e AM. SP está com UTC 3 e AM UTC 4:Alexandre Silva escreveu:se está ou nao em horario de verao ou se tem como pegar a timezone direto -02:00 -03:00 -04:-00
<retConsStatServ versao="3.10" xmlns="http://www.portalfiscal.inf.br/nfe">
<tpAmb>2</tpAmb>
<verAplic>SP_NFE_PL_008i2</verAplic>
<cStat>107</cStat>
<xMotivo>Serviço em Operação</xMotivo>
<cUF>35</cUF>
<dhRecbto>2017-09-04T09:30:52-03:00</dhRecbto>
<tMed>1</tMed>
</retConsStatServ>
<retConsStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="3.10">
<tpAmb>2</tpAmb>
<verAplic>AM3.10-4.00</verAplic>
<cStat>107</cStat>
<xMotivo>Servico em Operacao</xMotivo>
<cUF>13</cUF>
<dhRecbto>2017-09-04T08:36:22-04:00</dhRecbto>
<tMed>1</tMed>
</retConsStatServ>
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)
PROCEDURE Main
? DateTimeXml( Date(), Time(), "SP", .T. )
? TimeZone( Date() )
RETURN
FUNCTION TimeZone( dData )
RETURN Transform( Dtos( dData ), "@R 9999-99-99" ) + ;
"T" + Time() + ;
Transform( Right( Tip_TimeStamp(), 5 ), "@R X99:99" )
d:\temp>test
2017-09-04T10:46:22-03:00
2017-09-04T10:46:22-03:00
PROCEDURE Main
? DateTimeXml( Stod( "20170101" ), Time(), "SP", .T. )
? TimeZone( Stod( "20170101" ) )
FUNCTION TimeZone( dData )
RETURN Transform( Dtos( dData ), "@R 9999-99-99" ) + ;
"T" + Time() + ;
Transform( Right( Tip_TimeStamp( dData ), 5 ), "@R X99:99" )
2017-01-01T11:01:47-02:00
2017-01-01T11:01:47-02:00
2017-09-05 10:29 UTC Viktor Szakats (vszakats users.noreply.github.com)
...
* contrib/hbtip/misc.c
! TIP_TIMESTAMP(): fix to pad the day and year with zero
Ref: https://tools.ietf.org/html/rfc2822#section-3.3
Ref: https://developer.mozilla.org/docs/Web/HTTP/Headers/Date
! TIP_TIMESTAMP(): fix out-of-bounds array access when an empty
date was passed
% halve on-stack string buffer size
* comment cleanups
* contrib/hbtip/sessid.prg
! tip_DateToGMT(): fix to convert date to GMT (UTC)
...
Usuários vendo este fórum: Google Adsense [Bot] e 3 visitantes