DateToSortableText ( thedate )
Returns a sortable textual representation of a date value
Average rating: 4.3 (33 votes) Log in to vote
Theo Ros - Show more from this author |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Returns a sortable textual representation of a date value.
To text-sort dates, you will have to place the biggest unit (year) first,
followed by the month an day.
This will result in textvalues that will sort correctly, for instance
in a portal-sort solution.
Syntax: DateToSortableText ( thedate )
Return type: Text
Comments
Ryan Tayco Nov 17, 2021 |
||
/*------------------------------------------------------- Returns a sortable textual representation of a date value. To text-sort dates, you will have to place the biggest unit (year) first, followed by the month an day. This will result in textvalues that will sort correctly, for instance in a portal-sort solution. Syntax: DateToSortableText ( thedate ) Return type: Text DateToSortableText ( Get ( CurrentDate ) ) returns "20050530" if today is May 30, 2005 Author - Theo Ros ---------------------------------------------------------- Version: 2 Version Description: Added fix for Timestamp Edited By: Ryan Tayco Date: November 17, 2021 ----------------------------------------------------------*/ Let ([ ~date = Year ( thedate ) & Right ( "00" & Month ( thedate ) ; 2 ) & Right ( "00" & Day ( thedate ) ; 2 ); ~time = Right ( "00" & Hour ( TimeFormatAs ( thedate ; 24 ) ) ; 2 ) & Right ( "00" & Minute ( thedate ) ; 2 ) & Right ( "00" & Seconds ( thedate ) ; 2 ) ]; ~date & ~time ) |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.