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

yyyymmdd string and YTD

Status
Not open for further replies.

dmccallum

Programmer
Jan 5, 2001
90
US
How can I convert my delivery date in the format of a string (yyyymmdd) so that I can easily use the YTD function?
 
I use Macola software and they store their dates as an 8 digit integer YYYYMMDD and they supply a numbertodate UFL to convert the number to a date. If you give me your email address I'll gladly email it to you.

dgilsdorf@altavista.com

What database are you working with by the way? I thought the YYYYMMDD integer was fairly unique. Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
Create one of the following formulas:

This one will work for version 8 or later:
date(picture(totext({datefield},0),"xxxx/xx/xx"))

This one will work for all versions:
Date (tonumber(totext({datefield},0,"")[1 to 4]),
tonumber(totext({datefield},0,"")[5 to 6]),
tonumber(totext({datefield},0,"")[7 to 8]) ) Mike

 
Both formulas give me the error:

A statement is required here
 
Did you replace the {datefield} with your the string field you are trying to change to a date? Mike

 
Hi,

If the {datefield} is already a string the totext function is unnecessary !!

Just use...

Date (tonumber({datefield}[1 to 4]),
tonumber(datefield}[5 to 6]),
tonumber({datefield}7 to 8]) )

Geoff

 
date(picture(totext({reconcile.adjudication_DT},0),"xxxx/xx/xx"))

formula gives me an error
"To many arguments have been give to this function"
Please help!
 
if that field is a date, just use the NumbertoDate function I supplied:

NumbertoDate({jobcost.del_date})

Please let me know if you have any questions. Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
when using this formula

date(picture({reconcile.adjudication_DT},0),"xxxx/xx/xx")

I am getting "A string is required here and the cursor is at "0"
 
My last post sucked. Too early I guess. Using the NumberToDate function, if the field is an number in the YYYYMMDD format use the formula:

NumberToDate({jobcost.del_date})

If it is a text field in the "YYYYMMDD" format, then convert the text to a number first, then convert it to a date as follows:

NumberToDate(ToNumber({jobcost.del_date})) Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
sarakaj:
if your {reconcile.adjudication_DT} is a string use:
date(picture({reconcile.adjudication_DT},"xxxx/xx/xx"))

if it is a number the following should work:
date(picture(totext({reconcile.adjudication_DT},0),"xxxx/xx/xx"))


FoxG:
You are correct. I'm a creature of habit and am accustomned to changing a number to the date using the formula I posted. Mike

 
date(picture(totext({reconcile.adjudication_DT},0),"xxxx/xx/xx"))

looks good but if it was in a mm/dd/yyyy format then you could use the YTD function. Is there a way to change the format?
 
mbaron:
This is driving me nuts: I am pulling tha data from MSSQL 7.0 and in database it is a "char" "20011002", when applying the formula in: Format editor - text interpretation

date(picture({reconcile.adjudication_DT},"xxxx/xx/xx"))
I get "the formula has to be a number"

but when using
NumberToDate(ToNumber({reconcile.adjudication_DT}))
i get "the formula result must be a number"

am i in the wrong format field editor or something?
 
sarakaj:
You need to create a fomula field to change the date. The text interpetation area you mention has nothing to do with the change.

dmccallum: What are you getting when you but the formula in your report? It should be giving you mm/dd/yyyy format when it is placed in the report. Mike

 
Mike: you're right, it does, thanks so much for your help.
Sarakaj: Could you post the formulas you used?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top