Pitney Bowes MapInfo Professional User Manual

Page 246

Advertising
background image

DateTime

Time

Date

Converting

No conversion

Sets value to Time portion
of DateTime value.

Sets value to Date portion of
DateTime value.

DateTime

Additional Notes for Converting a String

* to a Date

If the year is last in the current Date format, you can omit it and MapInfo Professional will assume the
current year. If the data specifies a two-digit year, MapInfo Professional assigns the century based on
the current Date Window. If the Date is invalid the value is set to null and MapInfo Professional may
display the error, "Could not convert data."

** to a Time

MapInfo Professional accepts both military and AM/PM forms. The data can specify the entire locale in
AM or PM strings or use just the first character of each. The data may omit the milliseconds, seconds,
and minutes if the lower-order portions are also omitted. If the Time is invalid the value is set to null and
MapInfo Professional may display the error, "Could not convert data."

*** to a DateTime

The conversion rules for Date and Time apply for the respective portions of the string. If the data omits
the Time portion, MapInfo Professional assumes midnight. If the DateTime is invalid the value is set to
null and MapInfo Professional may display the error, "Could not convert data."

Additional Notes for Converting a Number to a String

# The conversion rules for Date and Time apply for the respective portions of the string. If the data omits
the Time portion MapInfo Professional assumes the Time is midnight. If the DateTime is invalid the value
is set to null and MapInfo Professional may display the error, "Could not convert data.".

If you have a lot of data and it is not in the format you require for your tasks, you can use one of the
MapBasic conversion functions to assist you with this process.

Creating a DateTime Column from Two Separate Columns

To create a DateTime column from a Date column and a Time column:

1. Open your data in MapInfo Professional Browser window. We use CrimeActivity.TAB from the

Introductory Data on your DVD.

2. Choose Table > Maintenance > Table Structure to display the Modify Table Structure dialog box.

3. Click Add Field and type a Date_Time label in the Name field.

4. Select Date/Time in the Type drop-down list and click OK.

5. Select Table > Update Column to display the Update Column dialog box.

6. Select the table name in the Table to Update drop-down list.

7. Select the name of the new column you just created in the Column to Update drop-down list.

8. Select the table name again in the Get Value from Table drop-down list.

9. Click the Assist button to display the Expressions dialog box.

10. Use the Column drop-down list to create the following expression and click OK:

DateColumnName + TimeColumnName

MapInfo Professional 12.5

246

Querying Your Data in MapInfo Professional

Advertising