+ Reply to Thread
Results 1 to 2 of 2

How to format time

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    367

    How to format time

    Hello,

    I have the below query to compute the Time difference of my two fields: d_Assigned and c_Date
    SqlQuery = "SELECT DateDiff('n', d_Assigned,c_Date) AS Time_Diff FROM tbl_List WHERE List_ID=" & ListID & ""
                    
                                                    With rs
                                    
                                                            .Open SqlQuery, conn
                                
                                                            
                                                    End With
           
           
                                    MsgBox (rs.Fields("Time_Diff").Value)
    d_Assigned and c_Date are both Date/Time (General Date)
    while Time_Diff is also Date/Time but in Long Time

    What i want is the result should be in this format: 00:00:00

    For example:
    
    d_Assigned = 02/17/2015 07:30:00 PM
    c_Date = 02/17/2015 08:00:00 PM
    
    Time_Diff = 00:30:00 PM
    When using the above code, the result I got is only 30


    Thanks in advance gurus!

  2. #2
    Registered User
    Join Date
    02-12-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    9

    Re: How to format time

    check out this link:
    http://stackoverflow.com/questions/2...ime-formatting

    and

    https://support.office.microsoft.com...rs=en-US&ad=US

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Format time from military time to standard time
    By Valencia0307 in forum Excel General
    Replies: 7
    Last Post: 06-01-2014, 11:15 AM
  2. Change format of lots of data cell to a time format
    By dazza67 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-24-2013, 03:24 PM
  3. Convert date and time in serial number format to text format
    By nda13112 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-11-2013, 02:45 PM
  4. Excel: How to convert time format into number format that can be added?
    By Frances Jones in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-17-2012, 04:10 PM
  5. Display time in time format instead of decimal format
    By CasualVisitor in forum Excel General
    Replies: 5
    Last Post: 07-03-2009, 06:24 PM

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