Timestamp to ISO 8601

  • Thread starter David Shorthouse
  • Start date
D

David Shorthouse

Hey folks,

Anyone know how to convert a timestamp (e.g. 1/24/2005 12:42:14 PM) to
ISO 8601-compliant. Specifically, I am hoping to convert the default general
date as above to 2005-01-24T19:42:14Z since my timestamps are in MST.

Thanks for any ideas,

Dave
 
J

John Nurick

Hi Dave,

If your code knows its timezone in terms of hours from Greenwich, I
think that all you need to do is something like this air code:

Dim dtZulu As DateTime
Dim strZulu As String

dtZulu = DateAdd("h", TimeZone, TimeStamp)
strZulu = Format(dtZulu, "yyyy-mm-dd\Thh:mm:ss\Z")

with a bit more fiddling if the timestamp is a string rather than a
date/time value.
 
D

David Shorthouse

Worked like a charm! For those who might be interested, here's my built
field in a query:

Date Last Modified:
Format(DateAdd("h",7,CollectionData!TimeStamp),"yyyy-mm-dd\Thh:nn:ss\Z")

Where CollectionData!TimeStamp is my timestamp field in another table and 7
is the addition in hours to the timestamp to convert from MST to GMT.

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top