+ Reply to Thread
Results 1 to 3 of 3

Date time stamp to date conversion

Hybrid View

N8237 Date time stamp to date... 11-16-2012, 09:59 AM
Norie Re: Date time stamp to date... 11-16-2012, 10:46 AM
N8237 Re: Date time stamp to date... 11-16-2012, 11:25 AM
  1. #1
    Registered User
    Join Date
    11-15-2012
    Location
    NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    44

    Date time stamp to date conversion

    Hi, I am hoping someone can help me with my problem.
    I have an extract from DB2 table and the format is November 16, 2012 12:00:00 AM EST, I am trying to convert it to 11/16/2012. I have tried changing to different date formats but no luck. I am trying to incorporate the date conversion functionality, which will be part of other simple code.

    I have attached a sample file, any help or responses would be greatly appreciated.

    Thanks
    Nitin
    Attached Files Attached Files
    Last edited by N8237; 11-16-2012 at 11:29 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Date time stamp to date conversion

    They aren't 'real' date values so formatting won't make a difference.

    Try this.
    Sub condt()
    Dim rng As Range
    Dim cl As Range
    
        Set rng = Intersect(ActiveCell.EntireColumn, ActiveSheet.UsedRange)
        Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count - 1)
        For Each cl In rng
            If cl.Value <> "" Then
                cl = DateValue(Left(cl, Len(cl) - 15))
            End If
        Next cl
    
    End Sub
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    11-15-2012
    Location
    NY, USA
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: Date time stamp to date conversion

    Thank you for the prompt response and a simple effective solution. Worked like a charm!! Thanks

+ 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