Jump to content

DateSerial to searchable date


jacger

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

Recommended Posts

I want to enter a date, add a set number of days, and produce another date. The second date must be searchable as a date. When I have tried this I have received a date serial that I have not figured how to convert back to a searchable date. I have used the date to text function and received acceptable formating, but then the date range search does not work as it is text (or the underlying serial.) Example: 4/7/00 is date A. Add seven days and get 4/14/00 in the second datefield. I can now search the second date field as a date. How do I do this.

Link to comment
Share on other sites

quote:

Originally posted by jacger:

I want to enter a date, add a set number of days, and produce another date. The second date must be searchable as a date. When I have tried this I have received a date serial that I have not figured how to convert back to a searchable date. I have used the date to text function and received acceptable formating, but then the date range search does not work as it is text (or the underlying serial.) Example: 4/7/00 is date A. Add seven days and get 4/14/00 in the second datefield. I can now search the second date field as a date. How do I do this.

You could create a calculated field called 'NewDate' as follows:

NewDate = Date( Month( DateToConvert), Day( DateToConvert) + DaystoAdd, Year( DateToConvert))

Where 'DateToConvert' is the date that you want to convert and 'DaystoAdd' is the number of days you would like to add to 'Date'.

Note: You could also use the Set Field function in a script to perform the calculation at a specified time so that 'NewDate' does not need to be a calculation field.

I hope that this helps.

Link to comment
Share on other sites

I think the problem is that the type of the result in you calculated date field is set to

"number" rather than "date". Calculated date fields should appear as dates and be searchable. If the calculated field is set to "number", it won't appear as a date and adding arcane calculations won't solve the problem!

-bd

Link to comment
Share on other sites

This topic is 8669 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.