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!

Multiplying Date by Number 1

Status
Not open for further replies.

addrever

Programmer
Jun 9, 2006
4
CA
I am trying to do the following:

(CDate(DateTimeValue({?DateFrom})) - 1) * 1440;

But I am getting a "this should be a number" and (CDate(DateTimeValue({?DateFrom})) - 1) highlighted

I have done this before in VB Script by typing:

var = CDate(Date) * 1440
var = var - 1440

Any suggestions or tips ?

Thanks,
 
What is the result supposed to represent? What are you trying to do?

-LB
 
I want to convert date/time to value where I can subtract one and multiply it by 1440 and result in an 8 digit timestamp.

For example: 3/8/2006 12:00:00 AM = 55847520
 
Try using the DateAdd() and the DateDiff() function. The dateDiff() will return a number, and dateAdd() will allow you to add/subtract time from a datetime field.
 
Try:

datediff("d",datetime(1899,12,31,0,0,0),{?datetime})*1440

Using December 31 instead of December 30 accomplishes the same as subtracting 1.

-LB
 
This works exactly with what I need. Now I just have to figure out to utilize the "hand picking the red marble" to get results back between the two values.
 
If you have a {?datefrom} and {?dateto}, you could use the following record selection formula:

{table.timestamp} in (datediff("d",datetime(1899,12,31,0,0,0),{?datefrom})*1440) to
(datediff("d",datetime(1899,12,31,0,0,0),{?dateto})*1440)

-LB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top