Datetime txhais li cas?
Datetime txhais li cas?

Video: Datetime txhais li cas?

Video: Datetime txhais li cas?
Video: Nrhiav npe thiab txhais npe 01/02/2023 2024, Kaum ib hlis
Anonim

DateTime yog ib tug qauv uas yuav tsis muaj null. Los ntawm MSDN: The Hnub tim hom nqi sawv cev rau hnub tim thiab lub sijhawm nrog cov nqi txij li 12:00:00 ib tag hmo, Lub Ib Hlis 1, 0001 Anno Domini, lossis AD (tseem hu ua Common Era, lossis CE) txog 11:59:59 PM, Kaum Ob Hlis 31, 9999 AD (CE)

Ua kom qhov no saib, DateTime hom hauv C# yog dab tsi?

Hnub tim yog tus nqi Hom zoo li int, ob npaug thiab lwm yam yog li tsis muaj txoj hauv kev los muab tus nqi null. Thaum a hom tuaj yeem muab null nws yog hu ua nullable, uas txhais tau tias tus hom tsis muaj nqi. Txhua Daim Ntawv Qhia Hom yog nullable los ntawm default, e.g. String, thiab tag nrho ValueTypes tsis yog, xws li. Ib 32.

Tsis tas li ntawd, yog DateTime nullable C#? Raws li lub neej ntawd Hnub tim tsis yog nullable vim nws yog ib hom nqi, siv tus nullable tus neeg teb xov tooj qhia hauv C# 2, koj tuaj yeem ua tiav qhov no. Siv lub cim lo lus nug (?) tom qab hom lossis siv hom generic Nullable.

DateTime ua haujlwm li cas hauv C#?

Ua haujlwm Nrog Hnub tim Siv C# Cov C# Hnub tim qauv sawv cev rau hnub tim thiab lub sij hawm nyob rau hauv C# thiab. Hauv C# , cov Hnub tim qauv sawv cev rau hnub thiab sijhawm. Tus nqi ntawm DateTime yog nruab nrab ntawm 12:00:00 ib tag hmo, Lub Ib Hlis 1, 0001 txog 11:59:59 P. M., Kaum Ob Hlis 31, 9999 AD

DateTimeOffset C# yog dab tsi?

Cov DateTimeOffset qauv suav nrog tus nqi DateTime, nrog rau cov cuab yeej Offset uas txhais qhov txawv ntawm qhov tam sim no DateTimeOffset Piv txwv hnub thiab sijhawm thiab Coordinated Universal Time (UTC).

Pom zoo: