Jump to content

Dates


dbustin

Recommended Posts

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

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

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

Archived

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

×
×
  • Create New...