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

  • Android Police

    Android Poli

    21 NİSAN 2010
  • disneychannel

    disneychanne

    19 ŞUBAT 2006
  • Justin Case

    Justin Case

    3 EKİM 2011