dbustin Posted March 29, 2012 Share Posted March 29, 2012 I have a job where the data came in yyyymmdd. I wrote a rule where it returns mm/dd/yyyy. Now a need a rule that turns it into January 10, 2011. I wrote this rule: return FormatDate(Rule("Expire Date", "mm dd, yyyy")); but it is returning the value as "u029efi0e29". Any ideas???? Thanks Link to comment Share on other sites More sharing options...
Dan Korn Posted March 29, 2012 Share Posted March 29, 2012 I have a job where the data came in yyyymmdd. I wrote a rule where it returns mm/dd/yyyy. Now a need a rule that turns it into January 10, 2011. I wrote this rule: return FormatDate(Rule("Expire Date", "mm dd, yyyy")); but it is returning the value as "u029efi0e29". Any ideas???? Thanks It looks like you have your parentheses in the wrong place. Also, you need to use "lm" to return the named month. Try this: return FormatDate(Rule("Expire Date"), "lm dd, yyyy"); Link to comment Share on other sites More sharing options...
dbustin Posted March 30, 2012 Author Share Posted March 30, 2012 Thanks. The year returns as 1912 though. Any ideas? Link to comment Share on other sites More sharing options...
Dan Korn Posted March 30, 2012 Share Posted March 30, 2012 Thanks. The year returns as 1912 though. Any ideas? What's being returned from Rule("Expire Date")? Does that specify four digits for the year? If not, then it's ambiguous, and you need to fix either that other rule or the data it's using to include the full four-digit year specification. You could also try this: return FormatDate(DateFromString(Rule("Expire Date")), "lm dd, yyyy"); The DateFromString function assumes that any two-digit year less than 30 is in this century, but it's still just an assumption. You need to make sure you're working with four-digit years all the way through, or you're going to have an ambiguity. This is the Y2K problem revisited. Link to comment Share on other sites More sharing options...
dbustin Posted March 30, 2012 Author Share Posted March 30, 2012 Thank You! Thank You! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.