Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Convert DATE to TEXT


The Digital Man

Recommended Posts

O.K. I know this should be simple but I can't seem to figure out how to convert a date to text. I really just need the last two characters of the year. i.e. "05" how do I derive this from say TODAYS DATE.

 

Thanks a million in advance.

 

If anyone knows of a book that covers all the Filemaker Functions in a well organized manner i.e. either alphabetically or grouped by function and it explains how to implement them let me know.

Link to comment
Share on other sites

right(year(date_field);2)

 

should get you there

 

a book that covers all the Filemaker Functions: have you tried the helper? otherwise, see the book section of our hosts' site....

 

kjoe

smirk.gif

Link to comment
Share on other sites

Thanks kjoe. So because the RIGHT function is a TEXT function it automatically converts the DATE(Or in this case YEAR) to TEXT?

 

So for todays date would I use: right(year(//);2)?

 

I guess I'm fixin to find out! Thanks again.

Link to comment
Share on other sites

actually, no, you can set the calc result to text. The default is a number. I was surprised to discover just now that the functions NumToText and DateToText have disappeared in v7.

 

[ QUOTE ]

So for todays date would I use: right(year(//);2)

 

[/ QUOTE ]

 

that one generated an error with me.

 

instead, try

 

Right(Year(Get ( CurrentDate ));2)

 

as an unstored calculation.

 

 

kjoe

smirk.gif

Link to comment
Share on other sites

Thank you very much! My version gave me an error too. I came back here to ask for more help and to my great pleasure the answer was already posted! smile.gif

 

Much appreciated.

 

DateToText was what I was remembering from Version 6. I thought maybe I was losing my mind when I couldn't find an appropriate function.

 

I actually used this in a script so apparently it made the conversion for me based on the field I was populating with it. I know in the SET FIELD Calculation box it told me the Calculation result must be text.

 

Anyway it works! Yippeeeeeeee!!! smile.gif

Link to comment
Share on other sites

GetAsText and GetAsNumber are the equivalent conversion functions in FM 7. However, FM treats dates much more cleanly, converting them to text when necessary, so the functions are required less often.

 

For example,

 

Enter Find Mode [ ]

Set Field [datefield; gdate1 & "..." & gdate2]

Perform Find [ ]

 

is valid in FM 7. Previous versions require using Insert Calculated Result and enclosing the global dates with DateToText( ).

 

You have to experiment to find out when the auto-conversion doesn't work. But for the most part, it's seamless.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...

Important Information

Terms of Use