Q
Problem solve Get help with specific problems with your technologies, process and projects.

# 'Type Mismatch' error when manipulating dates

I have two fields. Field1 is a text field with type computed and Field2 is date type. I have written an agent where I have to subtract these two fields. When I do this I get a error message saying "Type MisMatch." Can you please tell me why this is happening and what the remedy may be?
Dates are the hardest thing for me to work with. I usually end up doing a lot of stuff I probably don't have to when I start manipulating dates. So, if someone reads this and thinks, "Why is he doing that?" it's just from past experience, and I'm covering all my bases.

Let's say we have two fields, Field1 and Field2 (as in your problem). I'll compute Field1 to "07/24/2002 12:00:00 PM". I'll put in Field2 [07/21/2002 08:34 AM] as a Date/Time field value.

I'll put five more fields below the button (which I labeled "equals"):
- Field3 shows the number of total seconds between the two dates.
- Field4 shows the number of days (within Field3)
- Field5 shows the number of hours
- Field6 shows the number of minutes
- Field7 shows the number of seconds

So, in my example above, I would get 185161 seconds between the two times, which is:

2 Days 3 Hours 26 Minutes 0 Seconds

I'm going to do this in @Function and LotusScript, since you didn't mention which type of agent you were using. First the @Function:

NumDiffSeconds := @TextToTime(Field1) - Field2;
NumDays := NumDiffSeconds / 86400;
NumPartialDays := NumDays - @Integer(NumDays);
NumHours := NumPartialDays * 24;
NumPartialHours := NumHours - @Integer(NumHours);
NumMinutes := NumPartialHours * 60;
NumPartialMinutes := NumMinutes - @Integer(NumMinutes);
NumSeconds := NumPartialMinutes * 60;

FIELD Field3 := NumDiffSeconds;
FIELD Field4 := @Integer(NumDays);
FIELD Field5 := @Integer(NumHours);
FIELD Field6 := @Integer(NumMinutes);
FIELD Field7 := @Integer(NumSeconds);
@True

This was last published in July 2002

#### Have a question for an expert?

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

#### Start the conversation

Send me notifications when other members comment.

## SearchWindowsServer

• ### Azure PowerShell cmdlets monitor, manage VMs

PowerShell gives administrators a way to customize reports that hone in on the details that matter to the business, such as the ...

• ### Windows out-of-band patches overshadow April Patch Tuesday

Microsoft delivered out-of-band security patches to address the Total Meltdown and malware engine exploits as a precursor to its ...

• ### Microsoft Project Honolulu shows promise but needs work

Microsoft Project Honolulu is still in the technical preview stage, but it needs to resolve a number of issues before it's a ...

## Search400

• ### iSeries tutorials

Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

• ### V6R1 upgrade planning checklist

When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

• ### Connecting multiple iSeries systems through DDM

Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

## SearchDataCenter

• ### Guide to buying server performance monitoring software

Integration, storage and vendor support all affect whether a performance monitoring tool is right for an organization. Mull over ...

• ### How IBM's data science team quickens users' AI projects

In this Q&A, IBM's Seth Dobrin discusses the rising user interest in machine learning and AI projects and the help inexperienced ...

• ### IBM blockchain technology spotlights mainframes

IBM's blockchain offerings aim to ease enterprise IT concerns by combining Z system mainframe hardware with industry-specific ...

## SearchExchange

• ### Cloud-based email security tools barricade entry to Exchange

The pressure is on Exchange administrators to avoid a ransomware outbreak that cripples the on-premises email system. Cloud-based...

• ### Migrating public folders requires extensive planning

Do your homework to find the right option for public folders when making a move to Exchange Online. Here are guidelines to help ...

• ### Using Microsoft Exchange certificates requires planning

Exchange certificates typically require minimal management effort after they have been set up, and they offer a secure means of ...

## SearchContentManagement

• ### How a digital transformation process helped curb reliance on paper

By moving on from paper, the North Carolina Court System and the Texas Animal Health Commission were able to accommodate ...

• ### Intelligent information management is ready for AI, blockchain

A panel discussion at AIIM 2018 looked at how AI, cloud and blockchain will disrupt the intelligent information management space.

• ### SharePoint 2019 on premises the talk of SharePoint Fest D.C.

This episode of the Pipeline podcast breaks down SharePoint users' concerns about data migration, on-premises version support, ...

Close