Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.filemaker > #2470
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | Helpful Harry <HelpfulHarry@BusyWorking.com> |
| Newsgroups | comp.databases.filemaker |
| Subject | Re: Problem With Dates in a Script |
| Date | Wed, 04 Nov 2015 18:37:05 +1300 |
| Organization | Aioe.org NNTP Server |
| Lines | 59 |
| Message-ID | <041120151837053144%HelpfulHarry@BusyWorking.com> (permalink) |
| References | <1mdacbh.13bn8z3s523f7N%csampson@inetworld.net> <1mdb3n0.clubbf16ua01rN%clkaufmann@gmx.ch> <041120150857094318%HelpfulHarry@BusyWorking.com> <1mdc0d8.1vu8k8uw88oqgN%clkaufmann@gmx.ch> <1mdbv1y.yhiv3h1amyb43N%csampson@inetworld.net> |
| NNTP-Posting-Host | 7wMz7IDnsJS3HTqTJwl+qQ.user.speranza.aioe.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 8bit |
| X-Complaints-To | abuse@aioe.org |
| User-Agent | Thoth/1.8.4 (Carbon/OS X) |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| X-Face | vIZzK[X\z-._]-_:U?l@cBtwg<{a>ggn\mH}Vs>38E,#R%7h%U0'=4;1Q=erO %[T#a{YJfGvAbWmE@f_h]<rQ30+q;vqA^FUVx%\9{@r{gt${p^.L~bemFF@WY$r9fhuA F"1)$0+MgN+j8OO<SAec%$P;!M4Aj/kVitK5\xKmed-/3$2LiT1nI!-lKjt0B!qP_E{V ja+\#+[_uq8",IkoIF3M0}}qCD(& |
| Xref | csiph.com comp.databases.filemaker:2470 |
Show key headers only | View raw
In article <1mdbv1y.yhiv3h1amyb43N%csampson@inetworld.net>, Charles H.
Sampson <csampson@inetworld.net> wrote:
> Christoph Kaufmann <clkaufmann@gmx.ch> wrote:
> > Helpful Harry <HelpfulHarry@BusyWorking.com> wrote:
> >
> > > If the GetAsDate function doesn't work, you'll have to do the
> > > conversion quasi-manually within the script by parsing the text-date
> > > using the "/" character as the delimiter for each part.
> >
> > I suggest converting the date to its number format when defining the
> > script parameter:
> >
> > GetAsNumber ( YourDateField )
>
> I don't follow here. As I read the description of GetAsNumber,
>
> GetAsNumber ("1/2/2016")
>
> would return the number value 122016. Then, if that value is used as a
> script parameter, it would be implicitly converted to text ("122016").
> Then what should I do?
Working with dates and text dates can cause peculiar things to happen.
I'd just use the "/" character as the delimiter and parse out the
various parts of the text date. That way you know you've got what you
should have, rather than what automated functions *think* you should
have ... of course the data entry of the text date does have to be very
strict (always a "/", so no dates entered as "7.3.2015").
The Day* is everything up to, but not including, the first "/".
i.e.
TextDate_Day = Left(TDate; Position(TDate; "/"; 1; 1) - 1)
The Month* is the characters between the first "/" and the second "/"
(start after the first "/" and take the number of characters that is
all the characters minus everything up to and including the first "/"
and minus the five characters for the second "/" and four digit year).
i.e.
TextDate_Month = Middle(TDate; Position(TDate; "/"; 1; 1) + 1;
Length(TDate) - Position(TDate; "/"; 1; 1) - 5))
The Year is simply the last four digits (assuming the year is always
entered as four digits).
i.e.
TextDate_Year = Right(TDate; 4)
* You will need to swap the calculations for Day and Month if
you're using backwards American dates (MM/DD/YYYY).
To make it more efficient you could store the position of the first "/"
(Position(TDate; "/"; 1; 1)) in a variable so it is only calculated
once instead of three times.
Helpful Harry :o)
Back to comp.databases.filemaker | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Problem With Dates in a Script csampson@inetworld.net (Charles H. Sampson) - 2015-11-03 01:05 -0800
Re: Problem With Dates in a Script clkaufmann@gmx.ch (Christoph Kaufmann) - 2015-11-03 10:26 +0100
Re: Problem With Dates in a Script Helpful Harry <HelpfulHarry@BusyWorking.com> - 2015-11-04 08:57 +1300
Re: Problem With Dates in a Script clkaufmann@gmx.ch (Christoph Kaufmann) - 2015-11-03 22:15 +0100
Re: Problem With Dates in a Script csampson@inetworld.net (Charles H. Sampson) - 2015-11-03 20:23 -0800
Re: Problem With Dates in a Script Helpful Harry <HelpfulHarry@BusyWorking.com> - 2015-11-04 18:37 +1300
Re: Problem With Dates in a Script csampson@inetworld.net (Charles H. Sampson) - 2015-11-03 18:58 -0800
Re: Problem With Dates in a Script (Solved) csampson@inetworld.net (Charles H. Sampson) - 2015-11-04 01:23 -0800
csiph-web