Welcome to MacForumz.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Formatting Date Time

 
   Macintosh computer (Home) -> General Discussion RSS
Author Message
asimon623

External


Since: Feb 16, 2007
Posts: 5



(Msg. 1) Posted: Fri Feb 16, 2007 1:44 pm
Post subject: Formatting Date Time
Archived from groups: comp>sys>mac>apps (more info?)

Hi, im trying to generate a unique id for each record which are coming
from multiple sources into a single DB

I figured the best way would be to just do yeardatetime, but i want to
be able to sort with this number. The problem is that say, February
27 looks bigger than March 8th, (227 vs 38)
I can't figure out how to format the numbers to get single digit
months and dates to get a 0 in front. I m pretty new to filemaker. I
dont know if i have to do some sort of switch statement or if there's
an easy way.

Thanks

 >> Stay informed about: Formatting Date Time 
Back to top
Login to vote
asimon623

External


Since: Feb 16, 2007
Posts: 5



(Msg. 2) Posted: Fri Feb 16, 2007 1:46 pm
Post subject: Re: Formatting Date Time [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

This is filemaker by the way.I don't know if that was made clear or
not thanks

 >> Stay informed about: Formatting Date Time 
Back to top
Login to vote
Tom Stiller

External


Since: Jul 13, 2003
Posts: 2738



(Msg. 3) Posted: Fri Feb 16, 2007 5:20 pm
Post subject: Re: Formatting Date Time [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <1171662290.300441.85720 DeleteThis @v45g2000cwv.googlegroups.com>,
asimon623 DeleteThis @gmail.com wrote:

> Hi, im trying to generate a unique id for each record which are coming
> from multiple sources into a single DB
>
> I figured the best way would be to just do yeardatetime, but i want to
> be able to sort with this number. The problem is that say, February
> 27 looks bigger than March 8th, (227 vs 38)
> I can't figure out how to format the numbers to get single digit
> months and dates to get a 0 in front. I m pretty new to filemaker. I
> dont know if i have to do some sort of switch statement or if there's
> an easy way.
>

I use a cal field given by:
Let ( [time = Right("0"&
Hour(Get(CurrentTime));2)&Right("0"&Minute(Get(CurrentTime));2)&Right("0"
&Seconds(Get(CurrentTime));2);
date = Right( "0" & Month ( Get ( CurrentDate ) );2) & Right("0"&Day (
Get ( CurrentDate ) );2) & Year ( Get ( CurrentDate ) );
string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"];
Get ( RecordID ) & " " & Middle ( string ; Round ( Random*35 ; 0 ) ; 1 )
&" "& time & " " & Middle ( string ; Round ( Random*35 ; 0 ) ; 1 ) &" "
& date )

The result looks like
11738 S 141324 A 09272004

You can easily drop the RecodID and the two "random" characters and just
leave the time and date.

--
Tom Stiller

PGP fingerprint = 5108 DDB2 9761 EDE5 E7E3
7BDA 71ED 6496 99C0 C7CF
 >> Stay informed about: Formatting Date Time 
Back to top
Login to vote
patrick j

External


Since: Aug 13, 2006
Posts: 234



(Msg. 4) Posted: Fri Feb 16, 2007 9:52 pm
Post subject: Re: Formatting Date Time [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Feb 16, 2007 asimon623 DeleteThis @gmail.com wrote:

> Hi, im trying to generate a unique id for each record which are coming
> from multiple sources into a single DB

Hi

I haven't used Filemaker Pro for very many years. There is a newsgroup
for Filemaker Pro:

comp.databases.filemaker

I have never tried it, but if you don't get a decent answer here then
maybe someone will be able to come up with something there.



--
Patrick
Brighton, UK

<http://www.patrickjames.me.uk>
 >> Stay informed about: Formatting Date Time 
Back to top
Login to vote
asimon623

External


Since: Feb 16, 2007
Posts: 5



(Msg. 5) Posted: Sat Feb 17, 2007 1:36 pm
Post subject: Re: Formatting Date Time [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Feb 16, 5:20 pm, Tom Stiller <tomstil....DeleteThis@comcast.net> wrote:
> In article <1171662290.300441.85....DeleteThis@v45g2000cwv.googlegroups.com>,
>
> asimon....DeleteThis@gmail.com wrote:
> > Hi, im trying to generate a unique id for each record which are coming
> > from multiple sources into a single DB
>
> > I figured the best way would be to just do yeardatetime, but i want to
> > be able to sort with this number. The problem is that say, February
> > 27 looks bigger than March 8th, (227 vs 38)
> > I can't figure out how to format the numbers to get single digit
> > months and dates to get a 0 in front. I m pretty new to filemaker. I
> > dont know if i have to do some sort of switch statement or if there's
> > an easy way.
>
> I use a cal field given by:
> Let ( [time = Right("0"&
> Hour(Get(CurrentTime));2)&Right("0"&Minute(Get(CurrentTime));2)&Right("0"
> &Seconds(Get(CurrentTime));2);
> date = Right( "0" & Month ( Get ( CurrentDate ) );2) & Right("0"&Day (
> Get ( CurrentDate ) );2) & Year ( Get ( CurrentDate ) );
> string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"];
> Get ( RecordID ) & " " & Middle ( string ; Round ( Random*35 ; 0 ) ; 1 )
> &" "& time & " " & Middle ( string ; Round ( Random*35 ; 0 ) ; 1 ) &" "
> & date )
>
> The result looks like
> 11738 S 141324 A 09272004
>
> You can easily drop the RecodID and the two "random" characters and just
> leave the time and date.
>
> --
> Tom Stiller
>
> PGP fingerprint = 5108 DDB2 9761 EDE5 E7E3
> 7BDA 71ED 6496 99C0 C7CF

This is helpful, but i'm terrible at filemaker
I just need to have YearDateTime
With Date having four digits (0217 for today), and Time being in 24
hour time
It would be a great help thanks alot
 >> Stay informed about: Formatting Date Time 
Back to top
Login to vote
Tom Stiller

External


Since: Jul 13, 2003
Posts: 2738



(Msg. 6) Posted: Sat Feb 17, 2007 5:14 pm
Post subject: Re: Formatting Date Time [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <1171748188.182403.173300.RemoveThis@a75g2000cwd.googlegroups.com>,
asimon623.RemoveThis@gmail.com wrote:

> On Feb 16, 5:20 pm, Tom Stiller <tomstil....RemoveThis@comcast.net> wrote:
> > In article <1171662290.300441.85....RemoveThis@v45g2000cwv.googlegroups.com>,
> >
> > asimon....RemoveThis@gmail.com wrote:
> > > Hi, im trying to generate a unique id for each record which are coming
> > > from multiple sources into a single DB
> >
> > > I figured the best way would be to just do yeardatetime, but i want to
> > > be able to sort with this number. The problem is that say, February
> > > 27 looks bigger than March 8th, (227 vs 38)
> > > I can't figure out how to format the numbers to get single digit
> > > months and dates to get a 0 in front. I m pretty new to filemaker. I
> > > dont know if i have to do some sort of switch statement or if there's
> > > an easy way.
> >
> > I use a calc field given by:
> > Let ( [time = Right("0"&
> > Hour(Get(CurrentTime));2)&Right("0"&Minute(Get(CurrentTime));2)&Right("0"
> > &Seconds(Get(CurrentTime));2);
> > date = Right( "0" & Month ( Get ( CurrentDate ) );2) & Right("0"&Day (
> > Get ( CurrentDate ) );2) & Year ( Get ( CurrentDate ) );
> > string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"];
> > Get ( RecordID ) & " " & Middle ( string ; Round ( Random*35 ; 0 ) ; 1 )
> > &" "& time & " " & Middle ( string ; Round ( Random*35 ; 0 ) ; 1 ) &" "
> > & date )
> >
> > The result looks like
> > 11738 S 141324 A 09272004
> >
> > You can easily drop the RecodID and the two "random" characters and just
> > leave the time and date.
> >
> This is helpful, but i'm terrible at filemaker I just need to have
> YearDateTime With Date having four digits (0217 for today), and Time
> being in 24 hour time It would be a great help thanks alot

Clue: Right("0"&Hour(Get(CurrentTime));2) gets the zero-filled two
digit value for the current hour.

Filemaker's "Help" system is quite good.

--
Tom Stiller

PGP fingerprint = 5108 DDB2 9761 EDE5 E7E3
7BDA 71ED 6496 99C0 C7CF
 >> Stay informed about: Formatting Date Time 
Back to top
Login to vote
Tim Cutts

External


Since: Jun 24, 2004
Posts: 142



(Msg. 7) Posted: Thu Feb 22, 2007 3:07 pm
Post subject: Re: Formatting Date Time [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <1171662290.300441.85720 DeleteThis @v45g2000cwv.googlegroups.com>,
<asimon623 DeleteThis @gmail.com> wrote:
>Hi, im trying to generate a unique id for each record which are coming
>from multiple sources into a single DB
>
>I figured the best way would be to just do yeardatetime, but i want to
>be able to sort with this number. The problem is that say, February
>27 looks bigger than March 8th, (227 vs 38)
>I can't figure out how to format the numbers to get single digit
>months and dates to get a 0 in front. I m pretty new to filemaker. I
>dont know if i have to do some sort of switch statement or if there's
>an easy way.

Isn't the normal way to do unique identifiers in a database table to
have an autoincrementing column which provides them automatically? I
don't know whether FileMaker can do this.

Tim
 >> Stay informed about: Formatting Date Time 
Back to top
Login to vote
Wayne C. Morris

External


Since: Jun 28, 2003
Posts: 871



(Msg. 8) Posted: Thu Feb 22, 2007 6:29 pm
Post subject: Re: Formatting Date Time [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <1171748188.182403.173300 RemoveThis @a75g2000cwd.googlegroups.com>,
asimon623 RemoveThis @gmail.com wrote:

> > asimon... RemoveThis @gmail.com wrote:
> > > Hi, im trying to generate a unique id for each record which are coming
> > > from multiple sources into a single DB
> >
> > > I figured the best way would be to just do yeardatetime, but i want to
> > > be able to sort with this number.
[...]
> This is helpful, but i'm terrible at filemaker
> I just need to have YearDateTime
> With Date having four digits (0217 for today), and Time being in 24
> hour time
> It would be a great help thanks alot

You want an auto-filled Timestamp field.

Create a new field and set its type to "Timestamp". Keep that field
selected, click on Options, and click the Auto-Enter tab. Check the
"Creation" box; the popup next to it will say "Timestamp (Date and Time)".
Check the "Prohibit modification" box so that the field's value can't be
edited.

Whenever you create a new record, the current date and time will be stored
in that field.

A simpler option is to define the field as type "Number", and in the
Auto-Enter options, select Serial Number, Generate On Creation. FileMaker
will automatically assign a unique number to each record when it's created.
 >> Stay informed about: Formatting Date Time 
Back to top
Login to vote
Fred Moore

External


Since: Jul 15, 2005
Posts: 299



(Msg. 9) Posted: Fri Feb 23, 2007 11:34 am
Post subject: Re: Formatting Date Time [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article
<wayne.morris-D10A60.12293422022007 DeleteThis @shawnews.wp.shawcable.net>,
"Wayne C. Morris" <wayne.morris DeleteThis @this.is.invalid> wrote:

> In article <1171748188.182403.173300 DeleteThis @a75g2000cwd.googlegroups.com>,
> asimon623 DeleteThis @gmail.com wrote:
>
> > > asimon... DeleteThis @gmail.com wrote:
> > > > Hi, im trying to generate a unique id for each record which are coming
> > > > from multiple sources into a single DB
> > >
> > > > I figured the best way would be to just do yeardatetime, but i want to
> > > > be able to sort with this number.
> [...]
> > This is helpful, but i'm terrible at filemaker
> > I just need to have YearDateTime
> > With Date having four digits (0217 for today), and Time being in 24
> > hour time
> > It would be a great help thanks alot
>
> You want an auto-filled Timestamp field.
>
> Create a new field and set its type to "Timestamp". Keep that field
> selected, click on Options, and click the Auto-Enter tab. Check the
> "Creation" box; the popup next to it will say "Timestamp (Date and Time)".
> Check the "Prohibit modification" box so that the field's value can't be
> edited.
>
> Whenever you create a new record, the current date and time will be stored
> in that field.
>
> A simpler option is to define the field as type "Number", and in the
> Auto-Enter options, select Serial Number, Generate On Creation. FileMaker
> will automatically assign a unique number to each record when it's created.

Wayne's suggestions are very good ones, but perhaps there is something
even easier.

I missed the beginning of this thread, but if all you want is a unique
sequential numerical identifier (i.e. you're not going to do anything
with the number except use it as a sort mechanism or unique
identifier--you're not going to try to extract a date or time from it),
why not use the record ID which is built into every record. It's unique
to each table and sequential. If a record is deleted, its ID is not
reused.

To use the record ID, create a calculation field of type number. Set it
to equal Get(RecordID) and index it in case you want to use it to find a
specific record you had been using. And it's just that easy!

--Fred
 >> Stay informed about: Formatting Date Time 
Back to top
Login to vote
asimon623

External


Since: Feb 16, 2007
Posts: 5



(Msg. 10) Posted: Sat Mar 03, 2007 1:30 pm
Post subject: Re: Formatting Date Time [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Fred, I can't do that because the records are coming from about ten
different sources.


Right("0"&Year(Get(CurrentDate));2)&
Right("0"&Month(Get(CurrentDate));2)&
Right("0"&Day(Get(CurrentDate));2)&Right
("0"&Hour(Get(CurrentTime));2)&Right("0"&Minute(Get(CurrentTime));
2)&Right("0"&Seconds(Get(CurrentTime));2)

Was my answer by the way thanks

I don't know if that is the right way to do that, but it worked haha
 >> Stay informed about: Formatting Date Time 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> General Discussion All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]