0

I have a spreadsheet which contains the loading times for my website. I want to find the peak hour for my website.

However the dates are stored in the following format:

Jun 02, 2014 01:13:08 am
MMM DD, YYYY HH:MM:SS am / pm

How can I convert this in to date that excel will understand?

fedorqui
  • 252,262
  • 96
  • 511
  • 570
danstan
  • 95
  • 3
  • 11
  • You could change the cell formatting. – Matthijs Jun 02 '14 at 09:04
  • I've tried that, excel still does not see it as a date – danstan Jun 02 '14 at 09:05
  • Do you have an English language version of Excel? If so, there may be a non-printing character in the string -- probably a NBSP (ASCII 160). Try doing a Find/Replace to remove those characters. – Ron Rosenfeld Jun 02 '14 at 09:09
  • As a test, can you tell me what you get as a result of the formula: =A1+0 when A1 contains a slight modification to your string example: 02 Jun, 2014 01:13:08 am (be sure to format the cell as text before entering this string)? – XOR LX Jun 02 '14 at 09:30
  • See http://stackoverflow.com/questions/23587037/excel-vba-extract-the-correct-dates-from-badly-formatted-dates – MP24 Jun 02 '14 at 09:47

2 Answers2

3

To convert your "pseudo-dates" into real dates, select them and run:

Sub ConvertDates()
    Dim r As Range
    For Each r In Selection
        r.Value = CDate(r.Text)
    Next r
End Sub
Gary's Student
  • 94,018
  • 8
  • 54
  • 89
0

Another solution - via change in windows regional settings.

before/after

Start with .CVS file with date in MMM DD", "YYYY HH:MM:SS AM/PM

In windows 10, Open:

Control Panel > Clock and Region > Region

In long date, enter MMM dd,yyyy > OK.

Windows regional settings

Reboot, then open the excel file, the text is recognized as date.

Toni
  • 1,495
  • 4
  • 13
  • 22
Shahar
  • 1
  • 1