Building DateTime strings

Date and time data get stored in all sorts of ways. One of the more frustrating issues is that some common GIS formats (Shapefiles) can't store date and time in the same field without making it a string. This is fine for visual display but terrible for use with tools that use DateTime for their functionality, such as the TimeManager Plugin (refer to Chapter 4, Data Exploration).

Getting ready

Use datetime-example.shp, which contains a variety of date and time representations to play with.

How to do it…

  1. Load datetime-example.shp.
  2. Open the attribute table of datetime-example.
  3. Create a new field. As this is a shapefile, we'll need to use a String of length 30 (or you can use the empty field called calculated).
  4. Turn on layer editing ...

Get QGIS: Becoming a GIS Power User now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.