locked
Display Date only in VB.NET RRS feed

  • Question

  • Hello, I need to display only Date in VB.Net. But datetime.now displays Date and Time, But i want only date(MM/DD/YY) and same is the case for Time.

    Thank you in advance for the help. 

    with regards
    sindhup12
    Tuesday, December 2, 2008 10:40 AM

Answers

  • like this?

    Format(DateTime.Now, "dd MM yyyy") 
    • Proposed as answer by ddaemen Tuesday, December 2, 2008 11:11 AM
    • Marked as answer by Martin Xie - MSFT Friday, December 5, 2008 6:57 AM
    Tuesday, December 2, 2008 11:03 AM
  •         Dim tstDate As DateTime = DateTime.Now 
            Dim dateAsString As String = tstDate.ToString("MM/dd/yy"
            Dim timeAsString As String = tstDate.ToString("hh:mm:ss tt"
     

    Tuesday, December 2, 2008 12:00 PM

All replies

  • like this?

    Format(DateTime.Now, "dd MM yyyy") 
    • Proposed as answer by ddaemen Tuesday, December 2, 2008 11:11 AM
    • Marked as answer by Martin Xie - MSFT Friday, December 5, 2008 6:57 AM
    Tuesday, December 2, 2008 11:03 AM
  •         Dim tstDate As DateTime = DateTime.Now 
            Dim dateAsString As String = tstDate.ToString("MM/dd/yy"
            Dim timeAsString As String = tstDate.ToString("hh:mm:ss tt"
     

    Tuesday, December 2, 2008 12:00 PM