View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joeu2004[_2_] joeu2004[_2_] is offline
external usenet poster
 
Posts: 829
Default Date reformatting question

"DateNightmare" wrote:
I have a websurvey that collects information for me and
then allows me to export into a CSV file. The date the
form is submitted comes through in the following format
which seems to me to be a General formatted cell
and not a proper Date/Time cell. It comes through as:
2012-11-02 16:02:19 Etc/GMT
The problem is that I need these times to be in Pacific Time


The problem is made complicated by Daylight Savings Time. GMT is not
adjusted for DST.

I believe there is a way to take DST into account automagically by using a
system function in VBA. Do you want to go in that direction?

Alternatively, you could have a cell (e.g. D1) with 0 (not DST) or 1 (DST),
then use the following formula:

=LEFT(A1,19)-TIME(8-D1,0,0)

But that assume that date is always 10 characters and the time is always 8
characters. Probably true. But more generally:

=LEFT(A1,FIND(" ",A1,1+FIND(" ",A1)))-TIME(8-D1,0,0)