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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need formula for grouping datetime field

Status
Not open for further replies.

americvish

IS-IT--Management
Aug 5, 2010
26
US
can somebody pls mention the formula for below
i got for eachday,each week,month but needed for other:

for each day: datetime(date({table.datetime}),time(0,0,0))

for each week: datetime(date({table.datetime})-dayofweek({table.datetime})+1, time(0,0,0)

for each month: datetime(year({table.datetime}),month({table.datetime}),1,0,0,0)

for each two weeks
for each half month
for each quarter
for each half year
for each year
for each second
for each mintue
for each hour
for AM/PM

thanks.
 
Take a look at DatePart, that gives you the answer much more directly. Your Help function should give you details. DateAdd is also useful - and can subtract time, among other things.

This is based on Crystal 11. It always helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options.


[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top