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

Convert mm/dd/yyyy to 1900 date format ##### 2

Status
Not open for further replies.

jbarbato

Programmer
Apr 6, 2005
56
US
how do i convert a date of format mm/dd/yyyy to the 1900 date format of #####, where ##### is equal to the number of days after january 1, 1900?

example - mm/dd/yyyy = #
01/01/1900 = 1
06/01/2003 = 37773
07/01/2003 = 37802
 
oops - i forgot to mention - i am using crystal reports xi
 
I don't think there's a built-in function that does this, but something like this might work for you, based on your given examples:

DateDiff("d", Date(1899,12,31), {Table.DateField});

You can then format the resulting formula field to not show the decimals, if desired.

-dave


 
Try this.

datediff("d",date(1899,12,31),DATE(1900,1,1)) = 1
datediff("d",date(1899,12,31),DATE(2003,6,1)) = 37772
datediff("d",date(1899,12,31),DATE(2003,7,1)) = 37802

-LW


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top