Date Formats
Date and time format conventions used in the Fleetwork API.
ISO 8601 (Timestamps)
All timestamp fields use ISO 8601 format in UTC:
2026-04-15T08:30:00ZExample fields: createdAt, updatedAt, completedAt, expiresAt
Date Only
Scheduled dates use the YYYY-MM-DD format:
2026-04-15Example fields: scheduledDate, fromDate, toDate
Epoch Milliseconds
GPS timestamps and time-range queries use epoch milliseconds:
1713139200000Example: GPS trail startTime and endTime query parameters.
Conversion Examples
// ISO 8601 → Date object
const date = new Date('2026-04-15T08:30:00Z');
// Epoch ms → Date object
const date2 = new Date(1713139200000);
// Date → Epoch ms
const epoch = date.getTime();
// Date → ISO string
const iso = date.toISOString();Timezone
All API timestamps are in UTC (indicated by the Z suffix). Convert to local time in your client application:
const utcDate = new Date('2026-04-15T08:30:00Z');
const localString = utcDate.toLocaleString('vi-VN', {
timeZone: 'Asia/Ho_Chi_Minh'
});
// "15/04/2026, 15:30:00" (UTC+7)