+ Reply to Thread
Results 1 to 3 of 3

hot to convert a date object into a text (format yyyy-mm-dd)

  1. #1
    Registered User
    Join Date
    06-09-2006
    Posts
    62

    hot to convert a date object into a text (format yyyy-mm-dd)

    Hi there,
    I've been trying unsuccessfully to write a function that converts a DATE to TEXT(String) in the following format: yyyy-mm-dd

    example, say the user enter: 10-May-06, the function should return this value: 2006-05-10

    thanks for any help

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    You can pre-format the cell as yyyy-mm-dd then it would display that way.....or if you want a formula in another cell try

    =TEXT(A1,"yyyy-mm-dd")

    where your date is in A1

  3. #3
    Registered User
    Join Date
    06-09-2006
    Posts
    62
    Thanks!!!!

    it works on the spreadsheet. So assuming the input from the user is type DATE
    how would the function would look like?

    (the code below doesn't work)

    Function convert_date(myDay As Date)
    convert_date=TEXT(myDay ,"yyyy-mm-dd")
    End Function


    thank you for your help

+ 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