Solved

convert number to date

Posted on 2013-12-13
8
1,010 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 100

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 100

Accepted Solution

by:
mlmcc earned 500 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 100

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

738 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