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!

date to number 1

Status
Not open for further replies.

rgiesen

IS-IT--Management
Oct 9, 2003
12
US
i need to convert date into a number. i can not find a conversion in cr to do this. any suggestions?
 
what kind of number are you looking for???

eg. October 10, 2003

do you want it in the form ddMMyyy...10102003?

if so do this tonumber(totext({table.date},"ddMMyyyy"))

do you want it as a "dateserial"? then you can make up a formula for that if you want. There are many forms a number can take.

The statement: i need to convert date into a number

is meaningless as it stands

Jim Broadbent
 
My first suggestion is to post sample data. You give no specifics.

Mike
 
sorry I should have been more specific. Here is the formula I am woking on.

{INLOC.Qtyonhand}/(({@Wtqtyused} + {#Qtyship})/ (({@EndDate} - {@StartDate})/30.4166))

CR keeps telling me that @enddate and @startdate needs to be a number. These two fields are input by the user from and external program call Customization Workbench. I thought if I could convert the date to a number that would help solve my problem.

Thank you
 
You should be able to subtract to dates. But it seems that the end and start date formulas aren't resulting in dates. Put the fields on the report canvas and then do a mouse over. The tool tiip that appears will show you the field name followed by the field type (eg @EndDate (string))

You can also see the field type by right clicking on it in the field browser and choosing "browse data". The field type will appear at the top of the window that appears.

Mike
 
When I do a mouse over it does tell that it is a string and so does the browse data box.

Bob
 
You need to add the cdate function to change the End and start dates back to dates

change this:

{INLOC.Qtyonhand}/(({@Wtqtyused} + {#Qtyship})/ (({@EndDate} - {@StartDate})/30.4166))

to:

{INLOC.Qtyonhand}/(({@Wtqtyused} + {#Qtyship})/ ((cdate({@EndDate}) - cdate({@StartDate}))/30.4166))



Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top