SORU
21 EKİM 2009, ÇARŞAMBA


Nasıl bir DateTime Bugün ortaya çıkarsa kontrol etmek için?

Bir daha iyisi vardır .net bir şekilde eğer bir DateTime oluştu olmadığını kontrol etmek için 'bugün' aşağıdaki kodu?

if ( newsStory.WhenAdded.Day == DateTime.Now.Day &&
     newsStory.WhenAdded.Month == DateTime.Now.Month &&
     newsStory.WhenAdded.Year == DateTime.Now.Year )
{ 
    // Story happened today
}
else
{ 
    // Story didn't happen today
}

CEVAP
21 EKİM 2009, ÇARŞAMBA


if (newsStory.WhenAdded.Date == DateTime.Today)
{

}
else
{

}

Hile yapmak gerekir.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • уσ ρℓz sυв ιℓℓ sυв вαcқ

    уσ ρℓz

    14 EKİM 2010
  • The Brister

    The Brister

    10 ŞUBAT 2008
  • The Exploiteers

    The Exploite

    4 Ocak 2011