?
Solved

convert number to date

Posted on 2013-12-13
8
Medium Priority
?
1,126 Views
Last Modified: 2013-12-13
i am tapping into an excel sheet as my database source.  I have a settlement date column that is in MM/DD/YY format but when its pulled down into crystal reports it shows the date serial instead of the date format...and crystal thinks its a number so its not letting me change formatting to date.  So I figure I could just use a formula field to convert the number to date format...i know you can do this with string, but how about numbers?

for string i know you can do the following:
date(tonumber(left({table.datestring},4)),tonumber(mid({table.datestring},5,2)),tonumber(right({table.datestring},2)))

how can I work this for numbers to date?
0
Comment
Question by:IO_Dork
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 22

Expert Comment

by:Flyster
ID: 39717478
Have you tried:

 Format(tonumber,"mm/dd/yy")

Flyster
0
 

Author Comment

by:IO_Dork
ID: 39717502
no i have not, how is that incorporated/used?
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 39717515
WHat is it showing in Crystal?
Can you give an example?

mlmcc
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:IO_Dork
ID: 39717533
in excel the date is 7/9/97, in cyrstal that same date is displayed as 35,620.00
0
 

Expert Comment

by:richlando
ID: 39717544
stringvar stryear;
stringvar strmonth;
stringvar strday;

strday:= {table.datestring}[5 to 6];
strmonth:= {table.datestring}[3 to 4];
stryear:= {table.datestring}[1 to 2];

if yyear < "50" then
date(tonumber(stryear)+2000,tonumber(strmonth),tonumber(stryear))
else
date(tonumber(stryear)+1900,tonumber(strmonth),tonumber(stryear))
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 39717546
That looks like the number of days since 31 Dec 1899

Try this formula

DateSerial(1899,12,{YourField}+30)

Another one is

DateAdd('d',{YourField},Date(1899,12,31))

mlmcc
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 39717550
richlando - The field is a number not a string.

mlmcc
0
 

Author Closing Comment

by:IO_Dork
ID: 39717605
that worked perfectly (the first dateserial formula you suggested).
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question