PC Review


Reply
Thread Tools Rate Thread

Can I use standard Functions with MS Query?

 
 
=?Utf-8?B?Q0o=?=
Guest
Posts: n/a
 
      17th Dec 2006
I have a field that contains date and time, I would like to use the LEFT
function to trim off the data I do not want, as the output is to be used in a
pivot table (yikes). I am hooked to a FOXPRO database. Any suggestions?

Many thanks!
CJ
 
Reply With Quote
 
 
 
 
Tom Ogilvy
Guest
Posts: n/a
 
      17th Dec 2006
Date and time are stored as the elapsed number of days from a base date
(usually midnight preceding the start of 01/01/1900). So

? cdbl(now())
39068.6315162037
? now()
12/17/2006 3:09:32 PM

---------------------------------
so to separate time and date:


=Trunc(A1)
gives the date

=A1-trunc(A1)

gives the time.

in VBA

dt = int(Range("A1"))

dt1 = Range("A1")-int(Range("A1"))

to demo from the immediate window:

Range("A1") = now()
? range("A1").value
12/17/2006 3:05:17 PM
? int(Range("A1"))
12/17/2006
? cdate(Range("A1")-int(Range("A1")))
3:05:17 PM

of course, in Fox Pro, your value may very well be stored as a string - so
then it would depend on where you are getting the value from in your code.

--
Regards,
Tom Ogilvy


"CJ" <(E-Mail Removed)> wrote in message
news:E0EB5F99-1DDB-48D8-A074-(E-Mail Removed)...
>I have a field that contains date and time, I would like to use the LEFT
> function to trim off the data I do not want, as the output is to be used
> in a
> pivot table (yikes). I am hooked to a FOXPRO database. Any suggestions?
>
> Many thanks!
> CJ



 
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
Any way to use "standard" Excel functions inside VBA functions Nenad Tosic Microsoft Excel Programming 4 7th May 2010 09:11 PM
Three new functions that should be part of your standard set =?Utf-8?B?RGFycmVuIE9ha2V5?= Microsoft Excel Worksheet Functions 4 12th May 2006 11:56 PM
Problem with Standard Functions Mark A. Sam Microsoft Access Form Coding 8 21st Jan 2006 02:33 AM
standard functions not renognized itarnak Microsoft Excel Programming 1 24th Oct 2005 11:44 AM
What is the best way to handle standard functions used everywhere Gee Microsoft C# .NET 4 6th Feb 2004 02:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:49 PM.