elvis_impersonating_penguin Posted November 24, 2004 Posted November 24, 2004 ok, in the database I inherited there is a field that should be a date field, but was created as a text field. We wanted to change it to only allow dates so I changed it to a date field. Now here is the problem, any record that had that field as only a 2 digit year for the years 2000 - 2004, is now reading and 1900 - 1904. Is there anyway to create and run a script to change this? I guess I would need to add 100 years to the date, but I'm not exactly sure how to go about doing that. Any help would be much appreciated. Thanks, Rick
transpower Posted November 24, 2004 Posted November 24, 2004 If Year(date_field) < 1905 Set Field date_field Let ([mo = Month(date_field);dy = Day(date_field);yr=Year(date_field)+100]; Date ( mo ; dy ; yr ) )
elvis_impersonating_penguin Posted November 24, 2004 Author Posted November 24, 2004 Well i am using FM 6.. so i don't have a LET command, but i actually came up with something on my own right before you posted.. basically i did: SetField[DateField, TextToDate(Substitute( DateToText(DateField) , 190, 200 ))] I haven't done it on the full database yet, but it seems to have worked on the few records i tried it on.. Thanks though, Rick
transpower Posted November 24, 2004 Posted November 24, 2004 Well, good. I'm just so used to using Let now ... (besides, I'm an old Basic programmer who used to use Let all the time).
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now