Jump to content
Server Maintenance This Week. ×

TimeToText Calculation?


This topic is 8604 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I am using a Calculation field to incorporate time fields and text, in order to create a daily e-mail. The field displays time as 00:00:00, and I only require hour and minute accuracy. Is there a way to change this??

example of script =

"Task Start End Total" &

"p"

"Daily Backup:" & DBackup_Start & DBackup_End & DBackup_Total & ..........

Link to comment
Share on other sites

I think you're going to have to parse this manually.

Given a time field the following will convert it to a text field of the format 00:00

Left( TimeField, Position( TimeField, ":", 1, 1) - 1 ) & Middle( TimeField, Position( TimeField, ":", 1, 1) + 1, 2 )

You can integrate this into the rest of your equation and get the results you want.

Chuck

Link to comment
Share on other sites

quote:

Originally posted by Chuck:

I think you're going to have to parse this manually.

Given a time field the following will convert it to a text field of the format 00:00

Left( TimeField, Position( TimeField, ":", 1, 1) - 1 ) & Middle( TimeField, Position( TimeField, ":", 1, 1) + 1, 2 )

Left(TimeToText(TimeField), 5) is alot simpler and still results in 00:00

------------------

=-=-=-=-=-=-=-=-=-=-=-=-=

Kurt Knippel

Consultant

Database Resources

mailto:[email protected]

http://www.database-resources.com

=-=-=-=-=-=-=-=-=-=-=-=-=

Link to comment
Share on other sites

quote:

Originally posted by captkurt:

Left(TimeToText(TimeField), 5) is alot simpler and still results in 00:00


Isn't is possible that there isn't a leading zero on the hour portion, in which case a time like 1:11:11 woud return 1:11: (i.e., have the extra colon)? Would this be a problem? I was assuming that I couln't count on a leading zero, and that I didn't want an extra colon. I also figured that a leading zero in the minutes portion would be there, but perhaps that needs to be accounted for too:

Left( TimeField, Position( TimeField, ":", 1, 1) - 1 ) & Middle( TimeField, Position( TimeField, ":", 1, 1) + 1, Position( TimeField, ":", 1, 2 ) - Position( TimeField, ":", 1, 1 ) + 1 )

But perhaps I am making it more complex than it needs to be.

Chuck

[This message has been edited by Chuck (edited October 11, 2000).]

[This message has been edited by Chuck (edited October 11, 2000).]

[This message has been edited by Chuck (edited October 11, 2000).]

[This message has been edited by Chuck (edited October 11, 2000).]

Link to comment
Share on other sites

This topic is 8604 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.