Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding .Net DateTime to Foxpro date field
Message
From
13/02/2008 00:34:02
 
 
To
12/02/2008 17:45:16
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01291937
Message ID:
01292042
Views:
52
Tim,

I don't know how you were attempting to use a parameter, but check out this post from Cetin an example of what your syntax should be: Message #1229452

Let me know if that helps.

~~Bonnie




>Hi Bonnie,
>
>I had thought that would be an option, but it would seem I still need to get my standard DateTime formated. I found a built in function that gets me really close, so I will probably do this unless someone comes up with something a little cleaner.
>
>
>
>// Create and initialize a DateTimeForatInfo
>DateTimeFormatInfo myDTFI = new CultureInfo("en-US", false).DateTimeFormat;
>DateTime dt = DateTime.Now;
>string strDate = dt.ToString("u");
>// Gets me to this "2008-02-12 02:12:43Z"
>string foxDate = "{";
>foxDate += strDate.Substring(0, 10);
>foxDate += ",";
>foxDate += strDate.Substring(10, 9);
>foxDate += "A}";
>
>// gets me to this {2008-02-12,02:12:43A}"
>
>Would still need to add a line or two for the AM/ PM thing but hey, it should work.
>Thanks for the input
>Tim
>
>>
>>How about using Parameters? That *should* work ... (caveat: I haven't done any Fox w/ .NET, so take it with a grain of salt <g>)
>>
>>~~Bonnie
>>
>>
>>
>>>Ok I know I have been away from foxpro for awhile now and we still have a few fox tables around we use. I need to add a row to a fox table that contains a date. I am using a simple Insert command. Problem is the dot net DateTime structure is so different. Is there a way to change the format of get a format in C# Dot net that allows me to insert or update a fox table?
>>>
>>>DateTime myDate = DateTime.Now;
>>>Looks like 2/12/2008 11:35:44AM
>>>
>>>fox expects a date to look like this {^yyyy-mm-dd, hh:mm:ssa}
>>>I could parse this all out with a bunch of conversions but what a pain
>>>
>>>string foxDate = "{"
>>>foxDate += myDate.Year.ToString();
>>>foxDate += myDate.Month.ToString();
>>>etc. but this also would not quite conform since the month is 2 and would convert to "2" and not "02"
>>>
>>>Ideas welcome.
>>>Thanks
>>>Tim
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform