Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 697 Bytes

GCop535.md

File metadata and controls

37 lines (26 loc) · 697 Bytes

GCop 535

"Use ToLocal() method instead, so you get control over it using via LocalTime.CurrentTimeZone."

"Use ToUniversal() method instead, so you get control over it using via LocalTime.CurrentTimeZone."

Rule description

...

Example1

DateTime? fromDate = LocalTime.Now;
var myTestVar = fromDate.Value.ToLocalTime();

should be 🡻

DateTime? fromDate = LocalTime.Now;
var myTestVar = fromDate.Value.ToLocal();

Example2

DateTime? fromDate = LocalTime.Now;
var myTestVar = fromDate.Value.ToUniversalTime();

should be 🡻

DateTime? fromDate = LocalTime.Now;
var myTestVar = fromDate.Value.ToUniversal();