简体   繁体   中英

EF Core Migration Timestamp has wrong time(zone)

I have an EF Core Code First Project and use EF Core 3.1.0-preview2.19525.5. When I create a new migration with Add-Migration , the timestamp is one hour in the past.

Example 20191110 1739 16_MickeyMouse.cs is a migration I created today at 18:39

My machine an English Windows 10 device based in Germany and the timezone is configured to UTC+1 (Amsterdam, Berlin, ...)

Not that this a problem at all, but I am just wondering. Where does the timestamp come from? I would expect just the developer's local time.

Not sure, but sounds like the timestamp in the migration class name is the UTC datetime.

You can verify this by changing your pc's timezone to UTC+2 and create a new migration. I expect the timestamp to be 2 hours ahead of that timezone.

The timestamp isn't in UTC is it? That would make sense as it would enable developers in different geographical locations to work on a project without migrations being done in the wrong order because one was done, for example, four hours after a previous migration but in a timezone that would stamp the file as ahead of the previous migration.

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