Dan-A Posted July 19, 2003 Posted July 19, 2003 Hi All, Is there a way to test (see) what the system date format is?? (yyyy/mm/dd, dd/MM/yyyy or even in french: aaaa/MM/jj etc.) I was able to test for language, but the user could still have a different set-up for dates. Also if i want to add 6 days to a date, will the system format affect how my calculation is done?? (date + 6)--> or will this give me 6 months or 6 years later depending on the system date??!! Thanks --Dan
-Queue- Posted July 19, 2003 Posted July 19, 2003 I would use Date( Month( date ), Day( date ), Year( date ) ) since it will work in whatever date format the system is set. So, date + 6 => Date( Month( date ), Day( date ) + 6, Year( date ) ), which will return, for example, 1/5/2004, if date is 12/30/2003, in the format specified by the system.
Dan-A Posted July 21, 2003 Author Posted July 21, 2003 What am i doing wrong?? g_DateToPass is a text field. I want to be able (as mentionned in above posts) to pass a proper date no matter what the system format is. The problem i face is that this only works if a date is 5/5/2003 (May 5th) If i try with 5/27/2003 (May 27th) i get a ? in my date field, along with error message that says date should be dd/mm/yyyy. Date( Month( TextToDate( g_DateToPass )), Day( TextToDate( g_DateToPass )), Year( TextToDate( g_DateToPass ))) I thought the [color:"blue"] Date(Month, Day, Year) [color:"black"] function would use whatever system settings at the time of the db creation (ie: dd/mm/yyyy) Thanks for the help. --Dan
-Queue- Posted July 21, 2003 Posted July 21, 2003 Have you set your field width so you can see xX/XX/XXXX in your date field? I don't believe Date() will specify dd/mm/yyyy, but it will specify d/m/yyyy. The format you display in which you display it is up to you, based on your field formatting. To force two digits for the month and day, you'll need a case( Day( TextToDate( g_DateToPass )) < 10, "0" ) & Day(TextToDate( g_DateToPass )), etc. Have you tried making another field that is TextToDate( g_DateToPass ) and using that as the parameter for the Date() function, instead of the TTDs?
Dan-A Posted July 21, 2003 Author Posted July 21, 2003 I'm confused.....! I started from scratch to test a couple of things.... new Db file, date field ==> testDate. Using FM 5.5v2 on windows 98 machine! With Regional settings, date set to dd/MM/yyyy. I create a new record enter my date in the proper format---all is good. I go back to regional settings, date set to ==> MM/dd/yyyy. Delete all records in db file, Close my db file. Re-open create new record, enter date in MM/dd/yyyy format to match regional settings. Guess what i get an error message that says my date should be dd/MM/yyyy. Where am i forgetting to change/reset a preference!!! If i can't control a simple thing like that , no wonder the rest of my Date() function does not work!! Help! --Dan
Dan-A Posted July 21, 2003 Author Posted July 21, 2003 Forgot to mention that in the layout i have date field set to leave date as entered.
Dan-A Posted July 21, 2003 Author Posted July 21, 2003 Did more testing.... With the script step "Use system formats" I was able to solve my earlier "I'm confused post" But i noticed the following, the step "TextToDate" only seems to be able to translate to a valid date if the data is in the original date format from when the file was created. In reading the help file for system date/default date format. It sounds like the Use system format only displays & lets data be entered in a familiar format but does not change the actual "saved" format. So if my date go from dd/mm/yyyy (original format to mm/dd/yyyy (modified & accepted with the use of "use system format") The TextToDate function can't convert to a recognised date. --Dan
Recommended Posts
This topic is 7799 days old. Please don't post here. Open a new topic instead.
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