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

DateTime value as a String?

Status
Not open for further replies.

ziggs

Technical User
Sep 21, 2000
195
US
In order to get my Crystal Reports via the web working properly, I was given this advise:

If the time component of your DateTime value is important to the parameter’s use, we suggest converting the existing parameter to a Date type, adding a String parameter for the time value, and using a function within Crystal Reports to combine these values into a single DateTime value. You can then use the DateTime value returned by the function in place of the original DateTime parameter.

How can this be done? I checked the help files and can't make heads or tails from it. [sig][/sig]
 
ziggs: The function DateTime() will take a date and a time and combine them into one datetime field. Using your existing Date field is easy - to convert the Time string I suggest the following formula:

NumberVar hrs := Val(left(String,Instr(String,":")-1));
NumberVar mins:= Val(mid(String,Instr(String,":")+1));
NumberVar sec:=Val(right(String,if NumericText(right(String,2)) then 2 else 1)));

TimeVar mytime:=Time(hrs,mins,secs)

Hope this helps David C. Monks
david.monks@chase-international.com
Accredited Seagate Enterprise Partner
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top