Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CJ CJ is offline
external usenet poster
 
Posts: 102
Default Can I use standard Functions with MS Query?

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Can I use standard Functions with MS Query?

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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Three new functions that should be part of your standard set Darren Oakey Excel Worksheet Functions 4 May 12th 06 11:56 PM
standard functions not renognized itarnak[_8_] Excel Programming 1 October 24th 05 11:44 AM
Want to use standard excel functions in vb Mark Excel Programming 3 May 18th 05 03:22 AM
query functions Dean Excel Discussion (Misc queries) 1 March 13th 05 09:05 AM
MS Query - STANDARD DATE to YEAR-MONTH papegoja Excel Programming 1 October 14th 03 07:20 PM


All times are GMT +1. The time now is 08:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"