简体   繁体   中英

DateTime.Now accounts for DST

My DateTime object is assigned the local time using DateTime.Now. I wanted to know if this object will give the correct current local time once Daylight time begins/ends. Or do I need a workaround?

Yes, DateTime.Now is based on the local machine time.

Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM