DateTime UTC Daylight Savings Time NF-e

0

How can I change the time zone of a variable of type DateTime ?

The idea is to do a routine where the user does not need to change the computer time to perform NF-e transmissions, but it is dynamic without having to punch the current time zone in the code.

    
asked by anonymous 08.11.2017 / 14:53

1 answer

2

According to the taxpayer guidance manual, Sefaz does adopt daylight saving time. Therefore, you should enter the time zone -03: 00 when it is not in daylight saving time and -02: 00 when you are (considering Brasilia time).

Example of the dhEvento tag on page 81:

Data e hora do evento no formato AAAA-MMDDThh:mm:ssTZD
(UTC - Universal Coordinated
Time, onde TZD pode ser -02:00 (Fernando de
Noronha), -03:00 (Brasília) ou -04:00 (Manaus), no
horário de verão serão -01:00, -02:00 e -03:00. Ex.:
2010-08-19T13:00:15-03:00.
  

Link of the manual: link

One problem that can happen is that in windows there is the option Ajustar automaticamente para o horário de verão

  

(Considershippingtimeasnow,2:00p.m.)

Ifthisoptionisnotchecked,andyourscheduleiscorrect,youwillsend14:00onthe-03:00timezoneandthemachinewillreceiveat2:00p.m.onthe-02:00timezone.Therewillberejection.

Thecorrectoneistheoptionmarked,andthesendingwillbeinthe-02:00spindle,evenifitsspindleis(UTC-03:00)Brasília.

Ididsometesting:

Windowsspindle(UTC-03:00)Brasilia,uncheckedoption:

Console.WriteLine(DateTime.Now.ToString("yyyy-MM-ddTHH:mm:sszzz"));

Result: 2017-11-08T14:05:55-03:00

Windows spindle (UTC-03: 00) Brasilia, marked option:

Console.WriteLine(DateTime.Now.ToString("yyyy-MM-ddTHH:mm:sszzz"));

Result: 2017-11-08T14:03:34-02:00

    
08.11.2017 / 17:16