+ Reply to Thread
Results 1 to 3 of 3

Convert string to date

  1. #1
    Registered User
    Join Date
    06-04-2004
    Posts
    9

    Unhappy Convert string to date

    Dear Friends,

    I have a string dS = "2005-04-21" and I want to convert it to a date variable in order to proceed with date functions.

    How can I perform this operation?

    Thank you in advance.
    G.

  2. #2
    Registered User
    Join Date
    08-20-2003
    Location
    Luton, England
    Posts
    63
    The easiest way is to use declared variables, when Excel handles the conversion automatically :-
    Please Login or Register  to view this content.
    Regards
    BrianB
    Most problems are caused by starting from the wrong place.
    Use a cup of coffee to speed up all Windows processes.
    It's easy until you know how.
    -----------------------------------------

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Banavas,

    To convert the string to a Date type, use the CDate() function. This will convert any valid date string format into a Date Data Type. This function is also internationally aware.

    Convert a String into a Date Type:

    Dim MyDate As Date
    MyDate = CDate("2005-04-21")


    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1