Mismatch when converting unix timestamp to date - phpunit

I have a database (in CSV) with unix timestamps. I try to convert them in LibreOffice Calc into a human readable date. Everything is ok... except a one-day-lag.
For example, my timestamp is -518144400 (in E2 cell).
My function is : =E2/86400+DATEVAL("1/1/1970").
I obtain 19572,9583333333 which correspond to 1953-07-31.
This on-line calculator confirm the result.
What is the problem ? Just that the right answer is 1953-08-01.
First, I thought the timestamps contained a mistake. But, in this PHP calendar, if I paste -518144400 as parameter in the URL, it works. The on-line calendar associate this timestamp to (what I think is) the right answer.
I don't understand what happens. What I missed ?
One solution could be adding +1 in my function to correct. But I'm not satisfied, I'd like to understand...

It depends on conversion time zone, I mean that -518144400 (Timestamp) is equal to 1953-07-31 in GMT
While it will be 1953-08-01 in all other Time Zone where Time Relative to GTM is +1 or more.

Related

Return wrong date in moment js with full format "DD-MM-YYYYTHH:mm:SSZ"?

I'm using momentjs to convert String to date in with full value of date and time and the result always increases about 12 hours. just like the picture below.
So how come does it go like this and how I can do to solve the problem. Many thanks.
"Z" at the end indicates that the date is provided with UTC-0 zone. momentjs internally shifts the timezone to suit your own. You should omit it if you want to reformat provided datetime string.

Why filter ( as.Date(opp_date) == Sys.Date() ) is bringing yesterday's data?

I love using dplyr; I use it for everything. But, the problem I'm experimenting today is the following:
I'm trying to simply filter all rows fromm my opps table where opp_date is from today. So, when I use filter(opps, as.Date(opp_date) == Sys.Date()) it's bringing today's data but also yesterday's too, from 19:00:00 onwards.
To clarify any possible problem:
opp_date field is POSIXct class
Sys.Date() returns correctly my current date and time (just to check, Sys.time() brings the correct time and date: "2017-07-21 10:06:04 COT")
Any idea here? Thanks to the community for all the great inputs :)
The issue must be due to different time-zones; by default, R uses your system's local time-zone.
Try to explicitly set the environment variable as follows:
Sys.setenv(TZ='UTC')
Cannot add a comment due to low repputation, so posting this as an answer.
As I got to know recently, R dates are a formatting nightmare, especially through the base functions. Checkout lubridate package. You may want to convert your date column using dmy_hms function. It's easy and vectors are supported by default. Try it and let me know if the problem persists.
And please always try to provide sample data. Otherwise people cannot reproduce your problems.

Rapidminer : converting unix timestamp

Does anybody know a way to convert unix timestamp to date_time attribute?
I tried to use R extensions (my operators are mainly written in R) such as as.POSIXct functions to convert timestamps but it seems that rapidminer doesn't like it and keeps ignoring it.
Any help is appreciated
Thanks
A little known feature of generating attributes is that the input attribute can be the output attribute so no new one is created. In addition, the type of the attribute is changed.
In other words, a construction like this would work as long as the input is milliseconds since the epoch.
unixtime = date_parse(unixtime)

Does this time format look familiar?

Can someone help me tell what datetime format is this, or what are it's parts?
e.g.
201106020539Z0000031552001001
201106020702Z0000000000001
201105140701Z0000000000001
201105170207A0000018560001001
I think I've got the first few parts (201106020539 is yyyymmddhhmm), but from the Z / A character onward, I have no clue. Is it possible that the rest isn't a datetime at all?
The Z implies Zulu or UTC time https://meta.stackexchange.com/questions/14684/so-html-formats-time-incorrectly, as for what comes after, I don't know since all other time data has already been indicated prior to the Timezone Character.
Also, the fact that your timestamps don't seem to end in the same number of characters suggests they might not be the same format/spec? Where did you obtain them?
In which context did you get these strings? I would guess that the digits are the seconds fractions.
Maybe this helps you:
For a UTC time (a DateTime.Kind
property value of DateTimeKind.Utc),
the result string includes a "Z"
character to represent a UTC date.

dos date/time calculation

I am working on a project that involves converting data into dos date and time. using a hex editor (Hex Workshop) i have looked through the file manually and and found the values I am looking for, however I am unsure how they are calculated. I am told that the int16 value 15430 corresponds to the date 06/02/2010 but i can see no correlation, also the value 15430 corresponds to the time 07:34:12 but i am lost in how it is calculated. any help with these calculations would be very welcomed
You need to look at the bits in those numbers.
See here for details:
http://www.vsft.com/hal/dostime.htm
I know this post is very old but I think the time 07:34:12 corresponds to 15436 (not 15430).

Resources