Consulting

Results 1 to 4 of 4

Thread: Using datevalue with different languages

  1. #1

    Using datevalue with different languages

    Hello,
    I need to convert a date string like:"15 march 2012" into an actual date using vba.

    I know there is the function datevalue, but it doesn't work in my pc because I have an italian version of excel and it doesn't recognize the word march.

    my question is if it exists a way to use datevalue independently from the environmental international settings (e.g to instruct vba that the date string is in english/italian/german....).

    thank you in advance

  2. #2
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    =TEXT(TODAY();"[$-410]dddd d mmmm yyyy")

    or

    =TEXT(TODAY(),"[$-410]dddd d mmmm yyyy")

    or use the numberformat to translate the date into Italian.

    in VBA:
    Sub M_snb()
        msgbox  [text(today(),"[$-410]dd dddd mmmm yyyy")]
    End Sub
    Last edited by snb; 09-02-2013 at 03:03 AM.

  3. #3
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Something like:
    [vba]Dim strDate as String
    dim dteRealDate as Date
    strDate = "15 march 2012"
    dteRealDate = Evaluate("Datevalue(""" & strdate & """)")
    [/vba]
    Be as you wish to seem

  4. #4
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    OutStanding


    TEXT() & Cell Format snb = luned́ 2 settembre 2013
    Cell Format Italian(Swiss) = luned́, 2. settembre 2013
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

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
  •