ApI blueprint Date format - date

I have problem understanding the following date formate from apiblueprint tutorial
2016-02-05T08:40:51.620Z
I now 2016 is the year 02 is the month 05 is the date and 08:40:51 is the time but I dont understand the last part .620Z.
Can some one explain it for me. I wanted to find out AM or PM of the time using javascript from the date using javascript and not sure whether the formate is 12 or 24 hours.
Thanks

First of all, API Blueprint doesn't require you to use any particular Date format; you are free to use whatever you want to.
The format used in the tutorial is the standard ISO 8601 format: .620 is the number of miliseconds, and Z designates a Zulu timezone, meaning UTC.

Related

Keeping local Timezone information from an ISO 8601, RFC3339 formatted dates in iOS

I know there are tons of post regarding iso8601 strings and timezones but I could not find anything that really pinpoints the problem I had recently.
I have an ISO 8601 RFC3339 formatted string like: 2021-03-31T12:00:00+03:00.
I want to display the time associated with this date in the local time of the provided date meaning I want exactly "12:00" as the output. If my formatter has dateFormat of HH:mm
If I use an ISO8601DateFormatter to extract the date everything seems to work fine and the associated Date object is 2021-03-31 09:00:00 +0000. Which makes sense since 12:00GMT+3 = 09:00GMT+0
However this completely removes Timezone information from the Date object (which I know is by design on iOS).
While I understand the design behind this (most of the time we eventually should display the time in the user device timezone). There are quite a few exceptions like travel applications where we almost alway want to display the local time of departure/arrival.
My solution was to store the json serialized dates as Strings and use a combination of ISO8601DateFormatter to create the Date object in UTC and a normal DateFormatter that reconstructs the TZ from the +03:00 substring.
What's the best approach to solve this ?

Convert Exif date to different format

I am getting an exif date value like
EXIFPhotoDate: 1506173228000 and
UploadDate: 1506485214000
but I know it is
EXIFPhotoDate 23/9/2017, 23:27 and
UploadDate 9/27/2017, 01:59
The former is when queried via REST and the latter is when queried via the table.
How can I get standard date/time from a value like this?
Looks like you have a number of milliseconds since January 01 1970 in UTC. If you remove the 000 from the end, you will have a Unix timestamp, that is, the number of seconds since January 01 1970 in UTC:
unixTimestamp = 1506173228000 / 1000
Once your question doesn't state any programming language, it's hard to give you further help.

Need Date Format explanation

Can anyone please explain me the date format?
2015-10-14T10:07:13.024Z
Does 10:07:13.024Z mean today morning 10:07 am?
The Z is actually part of the ISO 8601 datetime and is used in the UTC dates.
To be specific Z means "Zulu time"
Does 10:07:13.024Z mean today morning 10:07 am?
The answer is Yes.

Date and timezone using j2me

I have a date string as input from an rss like:
Wed, 23 Dec 2009 13:30:14 GMT
I want to fetch only the time-part, but it should be correct according to the my timezone. Ie, in Sweden the output should be:
14:30:14
What is the best way? I want it to work with other RSS date formats as well if possible. Im using regexp right now but that is not very general.
Im having a hard time finding any library or support for dates and timezones in j2me?
/Br Johannes
In normal Java, I'd use a SimpleDateFormat object (that you create to match the pattern of the date you're getting in the RSS) to parse the String value and give you a Date object. Then, using a Calendar (which would be localized to your time zone), you'd be able to get the hour, minute, and second information.
I don't know j2me, but a google search suggests that these classes are available in j2me.

Handling time zones in Cocoa

I just want to clarify if I am understanding how dates & time zones work.
Basically, I have a date string #"2008-07-06 12:08:49" that I want to convert to an NSDate. I want this date and time to be in whatever the current user's time zone is set in. So if they are in GMT or HST, it's still 12:08:49.
If I have date in unix form 1215382129 (UTC) and my time zone is set to London (GMT), the outputted date from NSLog() is:
2008-07-06 12:08:49 +0100
If I then change my time zone to Hawaii (HST) and output the same date, I get:
2008-07-06 12:08:49 -1000
This seems to work fine, but I was under the impression to get the time in Hawaiian, I'd have to physically add the time difference (-10hrs) to the unix time stamp. Is this not required then?
Does that mean, whatever date and time a unix time is pointing to, it always points to the same date and time in whatever time zone a user is in?
Hope this makes sense!
Edit
I've just realised (thanks to Kevin Conner!) that in fact NSDateFormatter is creating different unix timestamps for that date string depending on the current timezone! So I was totally wrong!! :-)
Disclaimer, I'm mostly a Java guy. But Cocoa seems to work like the Java library in this regard: Dates are zoneless timestamps. Time zones are in the domain of formatting dates for display. In other words, the internal format doesn't consider time zones, it's all in UTC. Time zones are relatively a convenience for humans, so they are in the display/parsing side.
I noticed there is a setTimeZone: method on NSDateFormatter. Try calling that on your formatter before performing the format.