Lets say this is the time-stamp: 2011-07-06T00:00:35.851-07:00
What does that tell me? This is how I am trying to understand it:
2011-07-06 - date
00:00:35 - hh:mm:ss
851 - micro seconds??
07:00 - what does that tell me?
I need to convert this to UTC if possible with C.
Edit 0: Thanks for the responses by #RichieHindle and #Marc B. I now understand the GMT offset.
My problem now is, I am not getting correct value out of getdate.
It says it's July 6th, 2011, 35.851 seconds past midnight, in the GMT-7 time zone. To convert to UTC (GMT-0 timezone), you'd need to add 7 hours (-7 + 7 = 0), making it 2011-07-06T07:00:35.851-00:00
851 is milliseconds (thousandths of a second) and -07:00 is the timezone (UTC minus 7 hours).
Related
I am trying to convert UTC into MDT (mountain time) format. I am not sure which moment format require to convert date time into MDT. i tried moment.fromOADate(41493) but not working. TIA!
Mountain time is GMT -6, so you should be able to use moment().utcOffset(-6)
https://en.wikipedia.org/wiki/Mountain_Time_Zone
https://momentjscom.readthedocs.io/en/latest/moment/03-manipulating/09-utc-offset/
If you're worried about accounting for daylight savings time and can't just subtract 6 hours, you might also look into the moment.js timezone library.
You could say something like is described here and do var zone = moment.tz.zone('America/Chihuahua') (this is mountain time), then get your time offset with zone.parse(utcTimestamp)
I am importing information from an Oracle database on an AIX machine into SQL Server 2008r2. I inherited this process from the previous DBA. The timestamp comes in the following format: 4170180534, which, based on the conversion function in the executable, converts to the following:
417 = year (2017)
018 = days since beginning of year (018 converts to Jan 18)
0534 = time HH:mm
I need to provide maintenance on the conversion function (the previous DBA retired in 2016, so the date conversion function only works through the end of 2016).
Can anyone tell me exactly what this timestamp format is? I assume the '4' stands for the century, but it would be nice to know for sure what the first digit of the value actually is.
4should stand for weeks since start of year
format for that would be
(weeks since 1st jan, 2last digits of year, days since 1st jan, hours, minutes)
WW IY DDD HH MI
Could someone tell me what this datetime means?
2014-10-12T21:48:42-04:00
Why is there a T in the middle?
Why is there a -04:00 at the end? Does it represent the time between 2014-10-12T21:48:42 and 4 hours before that time (or 4 minutes)?
That is a timestamp in ISO 8601 format:
http://en.wikipedia.org/wiki/ISO_8601
Why is there a "T" in the middle?
That is the symbol separating the date from the time.
why is there a -04:00 at the end? Does it represent the time between
2014-10-12T21:48:42 and 4 hours before that time (or 4 minutes)?
That indicates the time zone offset from UTC
This is the ISO 8601 format used by the W3C.
That date time means October 12, 2014 at 21:48:42 at a timezone -4 hours from UTC.
SELECT CONVERT(time ,' 00:00:12 PM')
Why doesn't the above Code work. What to do to make it Work.
For some reason "00:00:00 PM" to "00:59:59 PM" fails to convert into Time :(
"1:00:00 PM" gets successfully Converted.
Thanks in Advance. Someone please help me out.
00:00 PM does not exist I think. It is either 12:00 AM or 12:00 PM. 00:00 only exists in the 24h format.
CONVERT can be used as a CAST but with a FORMAT for dates to get this already well understood literal to be a specific format.
You however want to use PARSE to get this maybe not so well understood literal to become a datetime or time (which doesn't have a format). To tell the engine how to interprrt the literal we type USING.
Check it:
SELECT PARSE(' 00:00:12 PM' AS time USING 'en-US')
I have been given a list of times (shop opening hours) but the format seems really weird and doesn't seem to be any format that I can figure out and they didn't specify what format the time is in.
I'm guessing it's pulled straight form a database but doesn't seem to be seconds.
Example
Opening time: 80000 (i'm assuming this is about 7:30 am in the morning )
Closing time: 170000 (i'm assuming this is about 9:00 pm)
Any guesses?
Looks like it could just be 8 AM (8:00:00) to 5 PM (17:00:00). Probably the last two digits are seconds, the two to the left of those are minutes, and the remaining digits are hours, from 0 to 23.