Jump to content

Text calc to reformat date


This topic is 6526 days old. Please don't post here. Open a new topic instead.

Recommended Posts

To use a date expression in an exported PDF filename I would like to convert a date field (i.e.; 10/16/2005) into a text expression (i.e.; 051016) so that the PDF file will sort properly in a directory list. Is there a way to do this with a text calculation?

Any help on this is greatly appreciated.

~Dennis

Link to comment
Share on other sites

Will this help?

Calc field>return as text:

Month(::DateField) & Day(::DateField) & Year (::DateField)

I use a similar approach to save as pdf as well as send a pdf as attachment to an email.

I have the date conversion field and a ::PdfFileName calc field.

Then concatenate the fields

Calc = "C:Documents and SettingsAlMy DocumentsFilemaker CMpdf FilesJobs" & ::DateField & ".pdf"

*Of course if you are using a MAC your filename protocol is different than Windows XP.*

Works fine for me.

HTH

Al

******************

Hey Ender:

I'll always bow to your experience. To also continue the learning process is there anything wrong with the way I laid this out? Is it open to possible problems or just another way to approach the problem?

AL

Edited by Guest
Link to comment
Share on other sites

Hey Al,

Month(::DateField) & Day(::DateField) & Year (::DateField)

Unfortunately, this would not sort correctly in an alphabetical listing. For example, your calc would take dates:

1/31/2005

2/12/2005

12/1/2005

1/31/2006

and result in:

1312005

2122005

1212005

1312006

or sorted:

1212005

1312005

1312006

2122005

This is why the order is changed to YYMMDD, and why it is necessary to pad any single-digit months and days.

Link to comment
Share on other sites

Ender wins the prize; this works very nicely... I'm so happy to have this solution to my perplexity.

btw, the millenium bug does not apply here, since the date range is within the last three years, so your original formula is perfect for this application. I am most appreciative.

~Dennis

Link to comment
Share on other sites

I see what you are saying and it makes sense. If I am using this as a stand alone and will be performing sorts it will be best. And I really didn't think about the Millennium issue. I'll have to look at all of my date fields and calculations and make sure I haven't left a bomb in there somewhere.

That's what I love about this forum, every time I come on I learn something new. Who said you can't teach an old dog new tricks. :

Al

Link to comment
Share on other sites

This topic is 6526 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.