dbTalk Databases Forums  

Formatting auto timestamp to text in a calculation question

comp.databases.filemaker comp.databases.filemaker


Discuss Formatting auto timestamp to text in a calculation question in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
cat
 
Posts: n/a

Default Formatting auto timestamp to text in a calculation question - 05-09-2007 , 09:29 PM






Hello,

I have a auto-create timestamp field that I've formatted through the
date and time format dialog boxes to be very close to what I need:
YYYYmm dd hhmm (24 hr clock, always 2 characters for month and day). I
need to export the time stamp into another application, and it would
be helpful to have the timestamp without spaces.

In order to get rid of the spaces, which I found I can do with

Substitute (timestamp_field);" "; "")

But to accomplish this, I have put the date into a calculated field,
which reverts the timestamp into what seems to be a default format -
e.g., 5/9/2007 6:42:39 PM. Hmm, I lose my original timestamp
formatting when I change timestamp to text in the calculation to
demolish spaces.

I've been looking through the help files here and see that I'm not
alone - but I haven't been able to write the correct formula to remedy
my situation and reformat the timestamp.

What I need is an auto-create timestamp in the format YYYYmmddhhmm (24
hr clock, always 2 characters for month and day).

Any suggestions?

Thanks so much for your time, it is always much appreciated!

enJoy,
cat


Reply With Quote
  #2  
Old   
FastWolf
 
Posts: n/a

Default Re: Formatting auto timestamp to text in a calculation question - 05-10-2007 , 12:55 AM






On 9 May 2007 19:29:02 -0700, cat <cathytyner (AT) gmail (DOT) com> wrote:

Quote:
Hello,

I have a auto-create timestamp field that I've formatted through the
date and time format dialog boxes to be very close to what I need:
YYYYmm dd hhmm (24 hr clock, always 2 characters for month and day). I
need to export the time stamp into another application, and it would
be helpful to have the timestamp without spaces.

In order to get rid of the spaces, which I found I can do with

Substitute (timestamp_field);" "; "")

But to accomplish this, I have put the date into a calculated field,
which reverts the timestamp into what seems to be a default format -
e.g., 5/9/2007 6:42:39 PM. Hmm, I lose my original timestamp
formatting when I change timestamp to text in the calculation to
demolish spaces.

I've been looking through the help files here and see that I'm not
alone - but I haven't been able to write the correct formula to remedy
my situation and reformat the timestamp.

What I need is an auto-create timestamp in the format YYYYmmddhhmm (24
hr clock, always 2 characters for month and day).

Any suggestions?

Thanks so much for your time, it is always much appreciated!

enJoy,
cat
Try creating a calculation field based on your timestamp. For the
calc use a Filter statement to extract the spaces and other extraneous
characters. Something like this:

[newfield] = Filter ( [timestamp]; "1234567890" )

Make sure your original timestamp has everything in the same order you
want your new one to have, i/e YYYY/MM/DD hh:mm will yield
YYYYMMDDhhmm.

Hope this helps.

--
FW


Reply With Quote
  #3  
Old   
cat
 
Posts: n/a

Default Re: Formatting auto timestamp to text in a calculation question - 05-10-2007 , 06:07 PM



On May 9, 10:55 pm, FastWolf <wolfsof... (AT) gmail (DOT) com> wrote:
Quote:
On 9 May 2007 19:29:02 -0700, cat <cathyty... (AT) gmail (DOT) com> wrote:



Hello,

I have a auto-createtimestampfield that I've formatted through the
date and time format dialog boxes to be very close to what I need:
YYYYmm dd hhmm (24 hr clock, always 2 characters for month and day). I
need to export the time stamp into another application, and it would
be helpful to have thetimestampwithout spaces.

In order to get rid of the spaces, which I found I can do with

Substitute (timestamp_field);" "; "")

But to accomplish this, I have put the date into a calculated field,
which reverts thetimestampinto what seems to be a default format -
e.g., 5/9/2007 6:42:39 PM. Hmm, I lose my originaltimestamp
formatting when I changetimestampto text in the calculation to
demolish spaces.

I've been looking through the help files here and see that I'm not
alone - but I haven't been able to write the correct formula to remedy
my situation and reformat thetimestamp.

What I need is an auto-createtimestampin the format YYYYmmddhhmm (24
hr clock, always 2 characters for month and day).

Any suggestions?

Thanks so much for your time, it is always much appreciated!

enJoy,
cat

Try creating a calculation field based on yourtimestamp. For the
calc use a Filter statement to extract the spaces and other extraneous
characters. Something like this:

[newfield] = Filter ( [timestamp]; "1234567890" )

Make sure your originaltimestamphas everything in the same order you
want your new one to have, i/e YYYY/MM/DD hh:mm will yield
YYYYMMDDhhmm.

Hope this helps.

--
FW
Thanks for your suggestion - there is a problem though. The filter
works as you said, but FM still does not retain my timestamp format
through the filter calculation. Perhaps ANY calculation would
translate the timestamp to text and therfore revert the timestamp
format to FM default of 5/9/2007 6:42:39 PM. So, even though I use
your filter on my formatted timestamp of YYYYmmddhhmm (24 hr clock,
always 2 characters for month and day), what I get is 59200764239 -
(FM default timestamp format without the spaces and non-numeric
characters). For what I need, this result is in the wrong order,
includes the seconds, is a 12 hour clock, and has only one character
for 1 digit month or day, e.g., May: 5 instead of 05.

Still stuck...but I liked learning the Filter function - very cool!

Any other possible solutions?




Reply With Quote
  #4  
Old   
cat
 
Posts: n/a

Default Re: Formatting auto timestamp to text in a calculation question - 05-10-2007 , 06:30 PM



On May 10, 4:07 pm, cat <cathyty... (AT) gmail (DOT) com> wrote:
Quote:
On May 9, 10:55 pm, FastWolf <wolfsof... (AT) gmail (DOT) com> wrote:



On 9 May 2007 19:29:02 -0700, cat <cathyty... (AT) gmail (DOT) com> wrote:

Hello,

I have a auto-createtimestampfield that I've formatted through the
date and time format dialog boxes to be very close to what I need:
YYYYmm dd hhmm (24 hr clock, always 2 characters for month and day). I
need to export the time stamp into another application, and it would
be helpful to have thetimestampwithout spaces.

In order to get rid of the spaces, which I found I can do with

Substitute (timestamp_field);" "; "")

But to accomplish this, I have put the date into a calculated field,
which reverts thetimestampinto what seems to be a default format -
e.g., 5/9/2007 6:42:39 PM. Hmm, I lose my originaltimestamp
formatting when I changetimestampto text in the calculation to
demolish spaces.

I've been looking through the help files here and see that I'm not
alone - but I haven't been able to write the correct formula to remedy
my situation and reformat thetimestamp.

What I need is an auto-createtimestampin the format YYYYmmddhhmm (24
hr clock, always 2 characters for month and day).

Any suggestions?

Thanks so much for your time, it is always much appreciated!

enJoy,
cat

Try creating a calculation field based on yourtimestamp. For the
calc use a Filter statement to extract the spaces and other extraneous
characters. Something like this:

[newfield] = Filter ( [timestamp]; "1234567890" )

Make sure your originaltimestamphas everything in the same order you
want your new one to have, i/e YYYY/MM/DD hh:mm will yield
YYYYMMDDhhmm.

Hope this helps.

--
FW

Thanks for your suggestion - there is a problem though. The filter
works as you said, but FM still does not retain my timestamp format
through the filter calculation. Perhaps ANY calculation would
translate the timestamp to text and therfore revert the timestamp
format to FM default of 5/9/2007 6:42:39 PM. So, even though I use
your filter on my formatted timestamp of YYYYmmddhhmm (24 hr clock,
always 2 characters for month and day), what I get is 59200764239 -
(FM default timestamp format without the spaces and non-numeric
characters). For what I need, this result is in the wrong order,
includes the seconds, is a 12 hour clock, and has only one character
for 1 digit month or day, e.g., May: 5 instead of 05.

Another concern I have - if the default date format is actually coming from my computer's clock, I may have another issue to tackle. This project is being used in a run-time solution, meaning it will live on various host computers, which I suppose could have various default date formats....so I think I need a calculation that works with the parts of a timestamp, rather than trimming and rearranging text...maybe, maybe not??

Still stuck...but I liked learning the Filter function - very cool!

Any other possible solutions?



Reply With Quote
  #5  
Old   
FastWolf
 
Posts: n/a

Default Re: Re: Formatting auto timestamp to text in a calculation question - 05-10-2007 , 10:06 PM



On 10 May 2007 16:07:24 -0700, cat <cathytyner (AT) gmail (DOT) com> wrote:

Quote:
On May 9, 10:55 pm, FastWolf <wolfsof... (AT) gmail (DOT) com> wrote:
On 9 May 2007 19:29:02 -0700, cat <cathyty... (AT) gmail (DOT) com> wrote:



Hello,

I have a auto-createtimestampfield that I've formatted through the
date and time format dialog boxes to be very close to what I need:
YYYYmm dd hhmm (24 hr clock, always 2 characters for month and day). I
need to export the time stamp into another application, and it would
be helpful to have thetimestampwithout spaces.

In order to get rid of the spaces, which I found I can do with

Substitute (timestamp_field);" "; "")

But to accomplish this, I have put the date into a calculated field,
which reverts thetimestampinto what seems to be a default format -
e.g., 5/9/2007 6:42:39 PM. Hmm, I lose my originaltimestamp
formatting when I changetimestampto text in the calculation to
demolish spaces.

I've been looking through the help files here and see that I'm not
alone - but I haven't been able to write the correct formula to remedy
my situation and reformat thetimestamp.

What I need is an auto-createtimestampin the format YYYYmmddhhmm (24
hr clock, always 2 characters for month and day).

Any suggestions?

Thanks so much for your time, it is always much appreciated!

enJoy,
cat

Try creating a calculation field based on yourtimestamp. For the
calc use a Filter statement to extract the spaces and other extraneous
characters. Something like this:

[newfield] = Filter ( [timestamp]; "1234567890" )

Make sure your originaltimestamphas everything in the same order you
want your new one to have, i/e YYYY/MM/DD hh:mm will yield
YYYYMMDDhhmm.

Hope this helps.

--
FW

Thanks for your suggestion - there is a problem though. The filter
works as you said, but FM still does not retain my timestamp format
through the filter calculation. Perhaps ANY calculation would
translate the timestamp to text and therfore revert the timestamp
format to FM default of 5/9/2007 6:42:39 PM. So, even though I use
your filter on my formatted timestamp of YYYYmmddhhmm (24 hr clock,
always 2 characters for month and day), what I get is 59200764239 -
(FM default timestamp format without the spaces and non-numeric
characters). For what I need, this result is in the wrong order,
includes the seconds, is a 12 hour clock, and has only one character
for 1 digit month or day, e.g., May: 5 instead of 05.

Still stuck...but I liked learning the Filter function - very cool!

Any other possible solutions?
You're right, I never realized how strict FMP is about storing dates.
You can format your dates to display any way you like, but they still
are stored on FMP's default format. However, I have most of the
solution worked out for you. There's enough here for you to go the
rest of the way on your own.

You need three new fields; for example:

d_date_only = [date field] = Creation Date

d_time_only = [time field] = Creation Time

t_date_string = [calc field: result is text] =
Right ( d_date_only ; 4 )
&"0"
&Left ( d_date_only ; 1 )
&Middle (d_date_only ; 3 ; 2 )
&Left ( d_time_only ; 2 )
&Right ( d_time_only; 2 )

The calc in this case adds the missing zero for the month since May is
a single digit month. You can use a few if/else statements to pick
out which months and days are 1 or 2 digit and format accordingly.

Hope this helps, and best of luck.

--
FW



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.