I am doing a simple query to retrieve data via ODBC and OdbcDataReader. However, I am not able to determine what the time zone of the data returned is. I have checked every doc and nothing tells me what it is (UTC or local). I tried to look for a setting in SQL Plus and was unable to find something there either.
Does anyone know or know what docs would say? Thanks!
#Madgui is correct with the timezone information. However, there was something else I wanted to mention.
In SQLplus, if you use SELECT ISO8601(IP_TREND_TIME) in your query, you will be returned an ISO8601 string.
If you are doing something in let's say C# and need this as a UTC time, you would have to do the following:
DateTime.SpecifyKind(DateTime.Parse(datareader["TREND_TIME"].ToString()).ToUniversalTime(), DateTimeKind.Utc)
DateTim.Parse will return as a LOCAL time, just an FYI which is why you need to to the .ToUniversalTime(). Also, never a bad idea to classify as UTC.
In AspenTech IP21 SqlPlus, every timestamps you are relevant to server timezone. If you are only interested in UTC offset (beware, timezone is not just that), you can ask the server its current time, and do the calculation:
--something like that :
WRITE GETDBTIME;
Also, if you have right on the server, you could call a system command (check the doc for the correct syntax) to have the name of the Timezone:
SYSTEM 'tzutil /g';
The best way to work using timezones in InfoPlus is ever use the function ISO8601(timestamp here). This way you avoid timezones conversions mistakes.
Related
If a date is specified in the format
start=2021-04-05&end=2021-05-05
does that mean that 2021-05-05 is excluded from the results?
and it's returning up to 11:59:59 on the 4th?
In an API I'm using, it seems to be behaving the same as
start=2021-04-05T00:00:00Z&end=2021-05-05T00:00:00Z when no time is specified.
A few things:
I think you are asking about the full-date format from RFC 3339, which is the same as the ISO 8601 extended date format: YYYY-MM-DD
Neither specification says anything about inclusivity or exclusivity of date-only ranges.
ISO 8601 does talk a bit about ranges (they call them intervals), but they are defined as a pair of instants, not whole dates.
The typical best practice (in my experience) would be to use a fully inclusive range for date-only values, or a half-open range for date-time values. For example:
[2021-04-05, 2021-05-05]
[2021-04-05T00:00:00, 2021-04-06T00:00:00)
However, this is not a hard rule. The actual details would be highly specific to the particular API you are using and how the authors of that API designed it to function.
A whole date like 2021-04-05 is not necessarily the same thing as 2021-04-05T00:00:00. In many cases, the reason to use a whole date is to not associate a time or a time zone at all. But again, this is highly implementation specific.
Nothing you've shown would imply that UTC (Z) is being used. If that's how the API is behaving, that's another implementation detail of that API.
I have unix timestamp in table, wants to show to user using Carbon. How can I achieve ?
e.g.
1487663764.99256 To
2017-02-24 23:23:14.654621
Did you check the carbon docs? I think this is what youre looking for:
Carbon::createFromTimestamp(-1)->toDateTimeString();
Checkout http://carbon.nesbot.com/docs/#api-instantiation
There are several ways to create Carbon instances described in the Carbon documentation, which is linked at the bottom of the project's README. The relevant section is this:
The final two create functions are for working with unix timestamps. The first will create a Carbon instance equal to the given timestamp and will set the timezone as well or default it to the current timezone. The second, createFromTimestampUTC(), is different in that the timezone will remain UTC (GMT). The second acts the same as Carbon::createFromFormat('#'.$timestamp) but I have just made it a little more explicit. Negative timestamps are also allowed.
So you can just do:
$carbon = Carbon::createFromTimestamp($dbResult['SomeTimestampColumn']);
If you really love your fluid method calls and get frustrated by the extra line or ugly pair of brackets necessary when using the constructor you'll enjoy the parse method:
Carbon::parse(1487663764);
Carbon::parse('first day of next month');
An API returned time in this format:
"05/29:00:45"?
It was probably manually entered.
I understand how to parse it but is this a common time format in some countries or software?
the format is month/Day and time (hours/second). Probably the correct format it will be 05/29/00:45
For date ranges, I currently use this format (until precise specifications come up):
<time datetime="2012-11">November 2012</time> - <time datetime="2013-01">January 2013</time>
I was wondering if there is, or will be, a way to indicate today's date. I mean, I know we can do this:
<time datetime="2013-03-05">Today</time>
but I would like to have something like this:
<time datetime="now">Today</time>
If not, I plan to leave the "Today" word with no extra markup. Would you recommend a better solution?
Thanks!
EDIT: To add bit of context, I am building an online resume, hence the date ranges as well as the ones that involve: <time datetime="yyyy-mm">[Month] [Year]</time> - Present.
Thanks everyone for your efforts.
Just to clarify things, I was not looking for ways to dynamically update the content of the datetime attribute. I just wanted to know if there was a way to semantically indicate the "present" day or time.
The answer is: no, there is no way to do that.
I do believe that there might be a change someday. Some of you wondered when this could be useful. I agree that currently there is no need for that, but there might be ways to indicate date ranges in the future specs (the <time> element is still in draft, after all). If so, there could be ranges that start at a precise point and that are still going, giving a use case for a "present"/"now"/... keyword, IMO.
Try using php or JavaScript to get the local time from the user's computer, then output that as text. See http://php.net/manual/en/function.localtime.php for instructions on doing it with php.
EDIT: It gets the server time, not the user's time. To get the user's time, you have to use javascript.
surfing the web i found this question, i thought it would be cool to answer since today we have an answer to that.
<time datetime="P4DT4H3M">four days, and three minutes</time>
To better understand you can see here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time
For my application, I'm importing the calendar event from google calendar. The only problem which I'm facing is Time zone list. I'm getting the timezone as output from google calendar xml, which I have to check with time zone list and add time accordingly... so from where I can get this standard time zone list.. or some other alternative to achieve the same.
If you're using Java, use Joda Time - the time zone ID given by Google Calendar will be one the Joda Time understands. The standard TimeZone class may well understand it too, but I think Joda is more likely to.
Assuming you're seeing all the VTIMEZONE stuff that goes along with the event, you can ignore the details - just use the ID.
Unfortunately there are some time zone IDs which have changed over time - I can't remember any examples off-hand, but you may need to do some translations if you're provided with the "old" names.
If you're using .NET, you really need to be using .NET 3.5 and the TimeZoneInfo class. Unfortunately that uses Windows names instead of Olson IDs, but there's a translation list available somewhere (I can dig it out if you want).
If you're not using either of these platforms, you basically need to find a library which supports Olson Zoneinfo names. (That wikipedia article has some helpful links at the bottom.)
I would definitely try to find a library which will be able to give you the relevant information based on an ID, rather than using the rules given back in the calendar entry. Time zones change over time, and the zoneinfo database contains historical and future information, but that can't be easily encoded in the calendar entry.
There are some good articles about working with Erlang date/time libraries here:
http://www.trapexit.org/Category:DateTimeRecipes
Hope it helps.
Check out these function
calendar:datetime_to_gregorian_seconds({Date, Time})
calendar:gregorian_seconds_to_datetime(Seconds) -> {Date, Time}
Converting to "gregorian seconds" and correcting the timezone-offset and converting back to date form is half the solution.
There is no library to access timezone datafiles in Erlang/OTP, and as far as I know there is no third part library to get at it either. So your options are to yourself convert the available timezone databases to something usable from Erlang, or to settle for just knowing a few of them.
You know, unless you want to start a project to read timezone data in Erlang. :-)