Results 1 to 5 of 5

Thread: how to convert date format

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    1

    how to convert date format

    hello folks
    i am new to vb. i have some columns in my table which are in "21-may-1998" format . But at my front end ( VB form) i pick it up thru a datepicker which is in " 6-23-1998" format . Can anybody plz tell me how to convert
    "5/26/2005" to " 26-may-2005"

    thanx in advance

  2. #2
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Three Anchor Bay, Cape Town, South Africa
    Posts
    769

    Re: how to convert date format

    This is a vb problem, not db.... Anyway, you probably have format options on the date picker. Look through the date pickers properties. Alternatively, you could try changing the system date format....

  3. #3
    Lively Member skv_noida's Avatar
    Join Date
    May 2005
    Location
    Noida, India
    Posts
    76

    Re: how to convert date format

    Use
    Date.ToString("dd-mmm-yyyy")

    Try this thing

  4. #4
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: how to convert date format

    Old VB/VBA
    format(<datevariable>,"dd-mmm-yyyy") - read up on format function

    .Net - no idea probably the same or what has been posted

    Depending on the DB you may be able to format in the Sql statement. Just another possibility.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  5. #5
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: how to convert date format

    Quote Originally Posted by yogi4yu
    hello folks
    i am new to vb. i have some columns in my table which are in "21-may-1998" format . But at my front end ( VB form) i pick it up thru a datepicker which is in " 6-23-1998" format . Can anybody plz tell me how to convert
    "5/26/2005" to " 26-may-2005"

    thanx in advance
    Really need to know the DB you are using.

    First - there is not format of 21-may-1998 in a DB. That's a display format that a client tool is showing you. Dates are stored in a binary format - numerically.

    So - again - what is the backend DB? What are you using for a provider to move data and is that in-line SQL statements or stored procedures.

    Show some code with how the update is failing for you.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

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