Discussion:
Splitting a datetime field into month, day, year, time stamp fields
(too old to reply)
Dan Freeman
2011-09-15 02:26:48 UTC
Permalink
You leave a lot of assumptions up in the air. But assuming you're using
VFP9, you're in the US, and this is basic character data, then

Month = GetWordNum(theField,1,"/")
Day = GetWordNum(theField,2,"/")
Year = GetWordNum(theField,3,"/")
Timepart = Getwordnum(theField,2," ")

If it's an actual DateTime data type, there are functions like TTOC().
You can find them (and follow the "see also" entires to find others) in
the help file.

Dan
1/7/2009 23:01:40
6/10/2009 02:26:33
12/28/2008 17:08:50
4/23/2009 20:48:56
I need to split each portion of the date information into fields of
there own. The problems I am dealing with is that as you can see in
the month or day field it may be 1 or 2 characters. Have no idea how
to deal with this issue.
My boss needs this for tomorrow. If someone could help me that would
be most appreciated.
Thanks
Howard
307-200-4117
gvm920
2011-09-15 16:34:12 UTC
Permalink
Post by Dan Freeman
You leave a lot of assumptions up in the air. But assuming you're using
VFP9, you're in the US, and this is basic character data, then
Month = GetWordNum(theField,1,"/")
Day = GetWordNum(theField,2,"/")
Year = GetWordNum(theField,3,"/")
Timepart = Getwordnum(theField,2," ")
If it's an actual DateTime data type, there are functions like TTOC().
You can find them (and follow the "see also" entires to find others) in
the help file.
Dan
1/7/2009 23:01:40
6/10/2009 02:26:33
12/28/2008 17:08:50
4/23/2009 20:48:56
I need to split each portion of the date information into fields of
there own. The problems I am dealing with is that as you can see in
the month or day field it may be 1 or 2 characters. Have no idea how
to deal with this issue.
My boss needs this for tomorrow. If someone could help me that would
be most appreciated.
Thanks
Howard
307-200-4117
Thanks so much that worked just fine. We receive data that comes from
advertising offers that incorporates the date time stamp as shown.
When it comes to identify periods of time that activity occurred I
needed to be able to split off the field so that it was possible to do
the actual activities. Thanks to you I can do that now. If I can be of
help in the future please keep in touch.

Thanks
Howard

Loading...