PC Review


Reply
Thread Tools Rate Thread

Advanced math

 
 
Joe
Guest
Posts: n/a
 
      20th Oct 2008
Does anyone know of any advanced math library's or a way to use math with a
DataTime DataColumn?


 
Reply With Quote
 
 
 
 
Gregory A. Beamer \(Cowboy\) - MVP
Guest
Posts: n/a
 
      20th Oct 2008
I am brainstorming here, but I think you can get the ticks via a TimeSpan
object from your DateTime struct to a struct from DateTime.Min

TimeSpan ts = MyDateTime - DateTime.MinValue;

You can then do a comparison to two dates in pure math, for example:

TimeSpan ts = MyDateTime - DateTime.MinValue;
TimeSpan ts2 = SecondDateTime - DateTime.MinValue;

To use math, you just need a common zero value to start with, which
DateTime.MinValue supplies.

What do you want to do with the date/time you are working with? Knowing this
might help me lead you to other ideas.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"Joe" <(E-Mail Removed)> wrote in message
news:uUhe%(E-Mail Removed)...
> Does anyone know of any advanced math library's or a way to use math with
> a DataTime DataColumn?
>



 
Reply With Quote
 
Joe
Guest
Posts: n/a
 
      21st Oct 2008
I probably should have explained it more.

We want to have a DataColumn.Expression = MyDateField + 365.
MyDateField is another field in the DataTable and we want to add 365 days or
some other value to it.

"Gregory A. Beamer (Cowboy) - MVP" <(E-Mail Removed)> wrote
in message news:%(E-Mail Removed)...
>I am brainstorming here, but I think you can get the ticks via a TimeSpan
>object from your DateTime struct to a struct from DateTime.Min
>
> TimeSpan ts = MyDateTime - DateTime.MinValue;
>
> You can then do a comparison to two dates in pure math, for example:
>
> TimeSpan ts = MyDateTime - DateTime.MinValue;
> TimeSpan ts2 = SecondDateTime - DateTime.MinValue;
>
> To use math, you just need a common zero value to start with, which
> DateTime.MinValue supplies.
>
> What do you want to do with the date/time you are working with? Knowing
> this might help me lead you to other ideas.
>
> --
> Gregory A. Beamer
> MVP, MCP: +I, SE, SD, DBA
>
> Subscribe to my blog
> http://feeds.feedburner.com/GregoryBeamer#
>
> or just read it:
> http://feeds.feedburner.com/GregoryBeamer
>
> ********************************************
> | Think outside the box! |
> ********************************************
> "Joe" <(E-Mail Removed)> wrote in message
> news:uUhe%(E-Mail Removed)...
>> Does anyone know of any advanced math library's or a way to use math with
>> a DataTime DataColumn?
>>

>
>



 
Reply With Quote
 
Miro
Guest
Posts: n/a
 
      21st Oct 2008
Take a look at something like this:

Dim StartDate As DateTime = DateTime.Today
Dim x As Integer = 365
StartDate.AddDays(x)

(written in notepad ) but that should do the trick.

"Joe" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I probably should have explained it more.
>
> We want to have a DataColumn.Expression = MyDateField + 365.
> MyDateField is another field in the DataTable and we want to add 365 days
> or some other value to it.
>
> "Gregory A. Beamer (Cowboy) - MVP" <(E-Mail Removed)>
> wrote in message news:%(E-Mail Removed)...
>>I am brainstorming here, but I think you can get the ticks via a TimeSpan
>>object from your DateTime struct to a struct from DateTime.Min
>>
>> TimeSpan ts = MyDateTime - DateTime.MinValue;
>>
>> You can then do a comparison to two dates in pure math, for example:
>>
>> TimeSpan ts = MyDateTime - DateTime.MinValue;
>> TimeSpan ts2 = SecondDateTime - DateTime.MinValue;
>>
>> To use math, you just need a common zero value to start with, which
>> DateTime.MinValue supplies.
>>
>> What do you want to do with the date/time you are working with? Knowing
>> this might help me lead you to other ideas.
>>
>> --
>> Gregory A. Beamer
>> MVP, MCP: +I, SE, SD, DBA
>>
>> Subscribe to my blog
>> http://feeds.feedburner.com/GregoryBeamer#
>>
>> or just read it:
>> http://feeds.feedburner.com/GregoryBeamer
>>
>> ********************************************
>> | Think outside the box! |
>> ********************************************
>> "Joe" <(E-Mail Removed)> wrote in message
>> news:uUhe%(E-Mail Removed)...
>>> Does anyone know of any advanced math library's or a way to use math
>>> with a DataTime DataColumn?
>>>

>>
>>

>
>


 
Reply With Quote
 
Cowboy \(Gregory A. Beamer - MVP\)
Guest
Posts: n/a
 
      21st Oct 2008
One way to do that is write a custom SQL statement to add the year

You can also use the row binding event to add another column. Just cast the
value into a DateTime (it should already be there with automagic stuff) and
use

MyDateTime.AddDays(365)

as the value for the column.

Hope this helps!

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"Joe" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I probably should have explained it more.
>
> We want to have a DataColumn.Expression = MyDateField + 365.
> MyDateField is another field in the DataTable and we want to add 365 days
> or some other value to it.
>
> "Gregory A. Beamer (Cowboy) - MVP" <(E-Mail Removed)>
> wrote in message news:%(E-Mail Removed)...
>>I am brainstorming here, but I think you can get the ticks via a TimeSpan
>>object from your DateTime struct to a struct from DateTime.Min
>>
>> TimeSpan ts = MyDateTime - DateTime.MinValue;
>>
>> You can then do a comparison to two dates in pure math, for example:
>>
>> TimeSpan ts = MyDateTime - DateTime.MinValue;
>> TimeSpan ts2 = SecondDateTime - DateTime.MinValue;
>>
>> To use math, you just need a common zero value to start with, which
>> DateTime.MinValue supplies.
>>
>> What do you want to do with the date/time you are working with? Knowing
>> this might help me lead you to other ideas.
>>
>> --
>> Gregory A. Beamer
>> MVP, MCP: +I, SE, SD, DBA
>>
>> Subscribe to my blog
>> http://feeds.feedburner.com/GregoryBeamer#
>>
>> or just read it:
>> http://feeds.feedburner.com/GregoryBeamer
>>
>> ********************************************
>> | Think outside the box! |
>> ********************************************
>> "Joe" <(E-Mail Removed)> wrote in message
>> news:uUhe%(E-Mail Removed)...
>>> Does anyone know of any advanced math library's or a way to use math
>>> with a DataTime DataColumn?
>>>

>>
>>

>
>


 
Reply With Quote
 
Joe
Guest
Posts: n/a
 
      21st Oct 2008
Unfortunately none of this helps. I need the DataColumn to calculate this
own it's own.

"Cowboy (Gregory A. Beamer - MVP)" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> One way to do that is write a custom SQL statement to add the year
>
> You can also use the row binding event to add another column. Just cast
> the value into a DateTime (it should already be there with automagic
> stuff) and use
>
> MyDateTime.AddDays(365)
>
> as the value for the column.
>
> Hope this helps!
>
> --
> Gregory A. Beamer
> MVP, MCP: +I, SE, SD, DBA
>
> Subscribe to my blog
> http://feeds.feedburner.com/GregoryBeamer#
>
> or just read it:
> http://feeds.feedburner.com/GregoryBeamer
>
> ********************************************
> | Think outside the box! |
> ********************************************
> "Joe" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>I probably should have explained it more.
>>
>> We want to have a DataColumn.Expression = MyDateField + 365.
>> MyDateField is another field in the DataTable and we want to add 365 days
>> or some other value to it.
>>
>> "Gregory A. Beamer (Cowboy) - MVP" <(E-Mail Removed)>
>> wrote in message news:%(E-Mail Removed)...
>>>I am brainstorming here, but I think you can get the ticks via a TimeSpan
>>>object from your DateTime struct to a struct from DateTime.Min
>>>
>>> TimeSpan ts = MyDateTime - DateTime.MinValue;
>>>
>>> You can then do a comparison to two dates in pure math, for example:
>>>
>>> TimeSpan ts = MyDateTime - DateTime.MinValue;
>>> TimeSpan ts2 = SecondDateTime - DateTime.MinValue;
>>>
>>> To use math, you just need a common zero value to start with, which
>>> DateTime.MinValue supplies.
>>>
>>> What do you want to do with the date/time you are working with? Knowing
>>> this might help me lead you to other ideas.
>>>
>>> --
>>> Gregory A. Beamer
>>> MVP, MCP: +I, SE, SD, DBA
>>>
>>> Subscribe to my blog
>>> http://feeds.feedburner.com/GregoryBeamer#
>>>
>>> or just read it:
>>> http://feeds.feedburner.com/GregoryBeamer
>>>
>>> ********************************************
>>> | Think outside the box! |
>>> ********************************************
>>> "Joe" <(E-Mail Removed)> wrote in message
>>> news:uUhe%(E-Mail Removed)...
>>>> Does anyone know of any advanced math library's or a way to use math
>>>> with a DataTime DataColumn?
>>>>
>>>
>>>

>>
>>

>



 
Reply With Quote
 
Joe
Guest
Posts: n/a
 
      21st Oct 2008
Yes I want a computed column and in the Expression I want to do date math.

"Patrice" <http://www.chez.com/scribe/> wrote in message
news:F8261B4B-0244-4CD8-98F4-(E-Mail Removed)...
> Do you mean you want a computed column ? This is posisbly throught the
> Expression property...
>
> "Joe" <(E-Mail Removed)> a écrit dans le message de groupe de
> discussion : (E-Mail Removed)...
>> Unfortunately none of this helps. I need the DataColumn to calculate this
>> own it's own.
>>
>> "Cowboy (Gregory A. Beamer - MVP)" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> One way to do that is write a custom SQL statement to add the year
>>>
>>> You can also use the row binding event to add another column. Just cast
>>> the value into a DateTime (it should already be there with automagic
>>> stuff) and use
>>>
>>> MyDateTime.AddDays(365)
>>>
>>> as the value for the column.
>>>
>>> Hope this helps!
>>>
>>> --
>>> Gregory A. Beamer
>>> MVP, MCP: +I, SE, SD, DBA
>>>
>>> Subscribe to my blog
>>> http://feeds.feedburner.com/GregoryBeamer#
>>>
>>> or just read it:
>>> http://feeds.feedburner.com/GregoryBeamer
>>>
>>> ********************************************
>>> | Think outside the box! |
>>> ********************************************
>>> "Joe" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>>I probably should have explained it more.
>>>>
>>>> We want to have a DataColumn.Expression = MyDateField + 365.
>>>> MyDateField is another field in the DataTable and we want to add 365
>>>> days or some other value to it.
>>>>
>>>> "Gregory A. Beamer (Cowboy) - MVP" <(E-Mail Removed)>
>>>> wrote in message news:%(E-Mail Removed)...
>>>>>I am brainstorming here, but I think you can get the ticks via a
>>>>>TimeSpan object from your DateTime struct to a struct from DateTime.Min
>>>>>
>>>>> TimeSpan ts = MyDateTime - DateTime.MinValue;
>>>>>
>>>>> You can then do a comparison to two dates in pure math, for example:
>>>>>
>>>>> TimeSpan ts = MyDateTime - DateTime.MinValue;
>>>>> TimeSpan ts2 = SecondDateTime - DateTime.MinValue;
>>>>>
>>>>> To use math, you just need a common zero value to start with, which
>>>>> DateTime.MinValue supplies.
>>>>>
>>>>> What do you want to do with the date/time you are working with?
>>>>> Knowing this might help me lead you to other ideas.
>>>>>
>>>>> --
>>>>> Gregory A. Beamer
>>>>> MVP, MCP: +I, SE, SD, DBA
>>>>>
>>>>> Subscribe to my blog
>>>>> http://feeds.feedburner.com/GregoryBeamer#
>>>>>
>>>>> or just read it:
>>>>> http://feeds.feedburner.com/GregoryBeamer
>>>>>
>>>>> ********************************************
>>>>> | Think outside the box! |
>>>>> ********************************************
>>>>> "Joe" <(E-Mail Removed)> wrote in message
>>>>> news:uUhe%(E-Mail Removed)...
>>>>>> Does anyone know of any advanced math library's or a way to use math
>>>>>> with a DataTime DataColumn?
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>

>>
>>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
changing math operations for math operations with = sign filo666 Microsoft Excel Programming 3 3rd Mar 2008 01:35 PM
Advanced math =?Utf-8?B?SmVmZg==?= Microsoft Excel Programming 0 27th Dec 2006 12:17 AM
How Math.Cos & Math.Sin is implemented? Morgan Cheng Microsoft C# .NET 13 17th Oct 2006 04:03 AM
excel math forumla? (simple math problem inside for math people!) Jason Microsoft Excel Discussion 3 16th Feb 2006 10:54 AM
Advanced Math Matthew Ellis Microsoft Access Queries 1 27th Sep 2004 10:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:43 AM.