Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTSToTimeString Query

Status
Not open for further replies.

SDS100UK

MIS
Jul 15, 2001
185
GB
Hi,

I have a DateTime field and and want to group the field by half hour intervals

this is my formula

DTSToTimeString({VW_PER_LOGGING.LOG_DATE})[1 to 5]

But it keeps saying that a String is required just after the first bracket.

Can anyone help me? What string is required???

Is there an alternative way to get what I need??

TIA

Steven
 
Try this:

If DatePart("n",{VW_PER_LOGGING.LOG_DATE}) in [1 to 30] then
ToText({VW_PER_LOGGING.LOG_DATE},"dd-MMM-yyyy HH:")&"30" else
If DatePart("n",{VW_PER_LOGGING.LOG_DATE}) in [31 to 59] or
DatePart("n",{VW_PER_LOGGING.LOG_DATE}) = 0 then
ToText({VW_PER_LOGGING.LOG_DATE},"dd-MMM-yyyy HH:")&"00"

You can now group by this field.


Reebo
UK

"Before you judge a man, walk a mile in his shoes. After that, who cares? ...He's a mile away and you've got his shoes." - Billy Connolly
 
Thanks Reebo,

However when I put it into my report it asks for " A number, currency amount, bolean or string" is required immediately after the "If" in the first line



Any ideas???

Cheers

Steven
 
ensure {VW_PER_LOGGING.LOG_DATE} is your field name.

Reebo
UK

"Before you judge a man, walk a mile in his shoes. After that, who cares? ...He's a mile away and you've got his shoes." - Billy Connolly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top