Need date format with hyphens...

Discussion created by GeoffreyMartin on Oct 3, 2015
Latest reply on Oct 4, 2015 by erolst

Hey all,


I want to set up a button to insert yesterdays date into a field.  The kicker is that it has to be entered into the field with hyphens, not the filemaker "/".  It's used in a URL and needs to be formatted as MM-DD-YYY.  Is there an easy way to do this?


Month (Get(CurrentDate) - Day(1)) & "-" & Day(Get(CurrentDate) - Day(1)) & "-" & Year(Get(CurrentDate) - Day(1))


This returns the correct format, but less one month, one day and one year.  Is text formatting the way to go (left, middle, right)?  The only issue there is that the leading 0 needs to be on the month if it's not October-December.