1
In the application I have a query that compares the current server time with a pre-set time - saved in a table:
select CAST(HORA_FECHAMENTO AS datetime) as HORA_FECHAMENTO,
CAST(CONVERT(VARCHAR(11),GETDATE(),8) as datetime) as HORA_ATUAL
from TB_ESTRACAO
where IDEXTRACAO = 1
When I send this information to the screen I am formatting as follows:
Session["hora_atual_servidor"] = String.Format("{0:T}", retornoHoraAtual.HORA_ATUAL);
Session["hora_final_valida"] = String.Format("{0:T}", retornoHoraAtual.HORA_FECHAMENTO);
The application running on the local machine shows me the information:
On the server, the information and view in this way:
To complete the server returns me the wrong time with a difference of nearly 40 minutes unless the current time is when it is 22:00 shows how 10:00 PM, how I could solve this problem?
The hosting is vbmahospedagem, the best price is the worst support of the internet, in all frankness.
– Harry
Well, since you can’t switch servers... you already tried to get the CURRENT TIME of the ISS SERVER and not SQL?
– PauloHDSousa
@Paulohdsousa, I will change server, because this one is complicated to work, more and as the formatting of the date, know why?
– Harry
It may be that your machine is configured PT-BR and the server you are using is American (American is more common)... Has a place to change in SQL.
– PauloHDSousa
yes, on the server this in English, as I have the closing date registered, I use the time so 20:00 is no 08:00 PM, I would do this formatting?
– Harry
Yes, Voce can do on the server side... on C#
– PauloHDSousa