|
FORUMS PROFESSIONNELS WINDEV, WEBDEV et WINDEV Mobile |
| | | | | |
Error In Previous Post on Reporting |
Débuté par Milton Kirkwood, 12 oct. 2005 10:38 - 3 réponses |
| |
| | | |
|
| |
Posté le 12 octobre 2005 - 10:38 |
The message should have read - Hi, I am having trouble when using dates in a report because they do not print out in the required format. In the analysis I specified a date with entry mask DD/MM/YYYY and returned value as DDMMYYYY. For example, I entered 30th September 2005 as 30/09/2005 and it shows that way in the data entry form. When it prints out in a report it prints as 05/20/3009. I have tried various DateToString and StringToDate conversions but to no avail. I did get it working using the following code by setting global variables Day is int Month is int Year is int NewDate is string and then using Day=RequestDate Month=RequestDate Year=RequestDate and constructing a date from this using - NewDate=NumToString(Day,"02d")+NumToString(Month,"02d")+NumToString(Year,"4d") DateRequired=NewDate Although it worked it seems a difficult way to |
| |
| |
| | | |
|
| | |
| |
Posté le 12 octobre 2005 - 11:21 |
Hi Milton, though dates can be shown in different ways (display/input mask) the way they have to be stored is only one: YYYYMMDD This is the format WinDev is using dates internally - as strings. All file items representing dates should be in the format YYYYMMDD as well! This is logical, because this format is the only way that returns a sorted date field. So, though there is the possibility to have another returned format, always choose YYYYMMDD ! The input / display mask is a different story. WinDev offers quite a number of options of how to display / input dates. You can choose the appropriate one or, if your program is for a number of countries, you can even define a different input / display mask for each language and if that's not enough, the mask could be changed even programmatically. Keeping that in mind, dates will always display nicely without any string-fiddling! Kind regards, Guenter
The message should have read - Hi, I am having trouble when using dates in a report because they do not print out in the required format. In the analysis I specified a date with entry mask DD/MM/YYYY and returned value as DDMMYYYY. For example, I entered 30th September 2005 as 30/09/2005 and it shows that way in the data entry form. When it prints out in a report it prints as 05/20/3009. I have tried various DateToString and StringToDate conversions but to no avail. I did get it working using the following code by setting global variables Day is int Month is int Year is int NewDate is string and then using Day=RequestDate Month=RequestDate Year=RequestDate and constructing a date from this using - NewDate=NumToString(Day,"02d")+NumToString(Month,"02d")+NumToString(Year,"4d") DateRequired=NewDate Although it worked it seems a difficult way to |
| |
| |
| | | |
|
| | |
| |
Posté le 12 octobre 2005 - 13:39 |
When you define a date field on a window, there are two format attributes. One for the data entry mask and another for how the date should be stored. How did you define the date storage attribute? |
| |
| |
| | | |
|
| | |
| |
Posté le 14 octobre 2005 - 00:04 |
Thanks Guenter, I appreciate the help and the prompt reply - I have been programming in Clarion for many years and just recently switched to Windev. Milton
Hi Milton, though dates can be shown in different ways (display/input mask) the way they have to be stored is only one: YYYYMMDD This is the format WinDev is using dates internally - as strings. All file items representing dates should be in the format YYYYMMDD as well! This is logical, because this format is the only way that returns a sorted date field. So, though there is the possibility to have another returned format, always choose YYYYMMDD ! The input / display mask is a different story. WinDev offers quite a number of options of how to display / input dates. You can choose the appropriate one or, if your program is for a number of countries, you can even define a different input / display mask for each language and if that's not enough, the mask could be changed even programmatically. Keeping that in mind, dates will always display nicely without any string-fiddling! Kind regards, Guenter The message should have read - Hi, I am having trouble when using dates in a report because they do not print out in the required format. In the analysis I specified a date with entry mask DD/MM/YYYY and returned value as DDMMYYYY. For example, I entered 30th September 2005 as 30/09/2005 and it shows that way in the data entry form. When it prints out in a report it prints as 05/20/3009. I have tried various DateToString and StringToDate conversions but to no avail. I did get it working using the following code by setting global variables Day is int Month is int Year is int NewDate is string and then using Day=RequestDate Month=RequestDate Year=RequestDate and constructing a date from this using - NewDate=NumToString(Day,"02d")+NumToString(Month,"02d")+NumToString(Year,"4d") DateRequired=NewDate Although it worked it seems a difficult way to |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|