Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Datetime to date
Message
 
To
13/09/2006 09:59:05
Yh Yau
Ingenuity Microsystems Sdn Bhd
Kuala Lumpur, Malaysia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01153290
Message ID:
01153297
Views:
18
This message has been marked as the solution to the initial question of the thread.
>In the process of converting VFP based database to SQL server.
>One problem faced is that for all date fields on screens( forms), as the dates fields (in VFP database) are now replaced by datetime in SQL, the fields are showing the time portion as well.
>Would like to know solution for following:-
>1) How to ensure all fields display only date portion of field. We also have the problem when capturing date values to our report queries, since the dates contain time, if we range the values (what used to be eg sales from 1/1/2006 to 31/1/2006 then, now we have to somehow default everything to 1/1/2006:00:00:00 to 31/1/2006:24:00:00. Any shortcut to do this?

Easiest way is to use CursorSchema and bind DateTime fields to Date if you use CursorAdapter. If you use RemoteViews you must Map fields also in View Designer. If you use SPT there is no way, than you must work around with TTOD() function to conver DateTime to Date.
If you use only date portions than in SQL Server they will be stored like 1/1/2006:00:00:00 so you could easyly use range
DateTime BETWEEN '20060101' AND '20060131'



>2) We use fields for data input, how to default the date fields instead of having null values displayed like 01/01/1900 of something like that.

I always set DateTime fields in SQL Server to be NULLable and have a custom class based on TextBox wich handle NULLs as empty Date.

>Thanks in advance
>Yau
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform