[V4RB] Trouble with dates

James Kleinschmidt jkleins at shentel.net
Sun Mar 7 07:17:36 CST 2004


Nevermind, I just realized Valentina doesn't use SQL date formats as 
defaults.
Thanks,

Jim
On Mar 5, 2004, at 3:48 PM, James Kleinschmidt wrote:

> I am having a little trouble with saving dates and would like your 
> advise. I can save a date in SQL format and the data gets mixed up. It 
> seems like the info is there but I am getting the month and day and 
> year in the wrong places. This has to be a simple problem but I can't 
> figure it out. Any help would be appreciated.
>
>
> I have a table with a field createdOn with this construction :
>    createdOn=new VDateTime("createdOn")
>
> I can make a sample table like this
>
>   for i = 1 to count
>     SetBlank
>     createdOn.SetDate(2004,1,i)
>     AddRecord
>   next
>
> This seems to work fine. I can show this is correct. (for recID 17 it 
> would be 2004-01-17
> Now when I try to update the table using SQL like:
> UPDATE users SET createdOn='2004-01-17 00:00:00' WHERE recID=17
>
> I get no errors but when I turn around and get cursor like:
> SELECT createdOn from users WHERE recID=17 I get a cursor with the 
> wrong info.
>
>  I can look through the cursor like this:
>     if r.Field(i).Type=kV_TypeDateTime then
>       theDate=new date
>       test=r.Field(i).GetString  -----> this shows 04/01/2017
>       theDate.Year=r.DateTimeField(i).Year ---> this is 2017
>       theDate.Month=r.DateTimeField(i).Month-->04
>       theDate.Day=r.DateTimeField(i).Day-->01
>       theDate.Hour=r.DateTimeField(i).Hour
>       theDate.Minute=r.DateTimeField(i).Minute
>       theDate.Second=r.DateTimeField(i).Second
>
> Thanks,
>
> JIm
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>



More information about the Valentina mailing list