Results 1 to 2 of 2
  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2009

    Cool Converting date and time format to date

    Hi All,

    I have a problem. I'm making a alarm clock and I need a way of converting a "dd/MM/yyyy HH:mm:ss" format into a date time format. This means I'll be able to compare the dates in a listbox using the for each function, to the current date and see whever it has passed and therfore the alarm should be deleted. It is currently in a string form so I can't use < and > to compare it to the current date as that is in a date form. I've tried using CDate but it doesn't work as it only will convert these formats:

    "August 12, 2004", "2:07:30 PM" and "August 12, 2004 2:07:30 PM"

    Can anyone help?



  2. #2
    Lively Member
    Join Date
    Apr 2010

    Re: Converting date and time format to date

    There's a few static members of the Date structure that can help your cause. Parse, TryParse, ParseExact, TryParseExact.

    Dim MyDate As DateTime
    If DateTime.TryParse("03/05/2010 11:23:21", MyDate) Then
      'It worked
    End If

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.