Converting date time

Posted on 2011-10-31
Last Modified: 2012-06-21
how do i convert

     7/12/2000 3:11:36 PM                    to               07-12-2000
     10/25/2000 2:02:29 PM                  to               10-25-2000

the basic requirements being 10 characters and dashes as dividers

using access 2000 at the moment and preferring a Query

Question by:intsup
    LVL 119

    Expert Comment

    by:Rey Obrero

             format(#7/12/2000 3:11:36 PM#,"mm-dd-yyyy")

    LVL 12

    Assisted Solution

    If your date is stored as a DateTime then

    Select Format(mycolumn, "dd-mm-yyyy") as DateString From myTable

    If your date is currently stored as a string you could try converting it to a string first using CDate then using Format to render it as a string

    Select Format( CDate(mycolumn), "dd-mm-yyyy") as DateString From myTable
    LVL 47

    Assisted Solution

    by:Dale Fye (Access MVP)
    Format(#7/12/2000 3:11:36 PM#, "mm-dd-yyyy")
    LVL 119

    Accepted Solution

    or using your field name


    take note that this will return a text string not date

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
    In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
    Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
    What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now