c# - How should I express this set of statements with Entity Framework? -


i set complex application uses entity framework related microsoft sql server databases. while seems simple express common queries linq, wonder how should express set of statements correctly (it returning scalar):

declare @tz smallint;  select @tz = datepart(tz, sysdatetimeoffset()); select cast(@tz / 60 varchar(5)); 

why not use c# equivalent:

datetime n = datetime.now; int tz = (n - n.touniversaltime()).hours; 

of cource assumes server , program in same timezone.


Comments