unix-timestamp

How to compare two dates using UNIX commands [closed]

ⅰ亾dé卋堺 提交于 2019-12-22 16:37:09
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have dates like this Date1="Wed Oct 21 13:05:14 2012" Date2="Wed Nov 21 12:55:30 2010" Date3="Wed Nov 21 14:22:30 2012" How do I find out the latest date? 回答1: The unix date command can convert date formats,

Wrong value returned after formatting timestamp

我们两清 提交于 2019-12-22 14:06:08
问题 I am trying to format a timestamp but the wrong value is returned. let timestampDouble: Double = 1455970380471 let timestamp = NSDate(timeIntervalSince1970: timestampDouble) let formattedTimestamp = NSDateFormatter.localizedStringFromDate(timestamp, dateStyle: .MediumStyle, timeStyle: .ShortStyle) formattedTimestamp returns Jun 22, 48115, 8:49 AM instead of the correct timestamp of Feb 20, 2016, 11:13 PM (from epochconverter.com). 回答1: You've got the wrong value. I reversed the process,

Unix Timestamp bigint(20)

放肆的年华 提交于 2019-12-22 11:31:38
问题 I am doing research in a MySQL database, and I suppose some timestamps are in Unix format. Those timestamps are in a bigint(20) field. I'm going crazy about them. How can I convert these to a regular timestamp? Example: 634583466272408810 634587264000000000 回答1: try select from_unixtime(634583466272408810/1000000000) See FROM_UNIXTIME 来源: https://stackoverflow.com/questions/12090772/unix-timestamp-bigint20

how convert unix timestamp to datetime

﹥>﹥吖頭↗ 提交于 2019-12-22 08:57:53
问题 I'm trying to convert this unix timestamp 1415115303410 in DateTime, in this way: private static DateTime UnixTimeStampToDateTime(long unixTimeStamp) { System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc); dtDateTime = dtDateTime.AddMilliseconds(unixTimeStamp); return dtDateTime; } But I get a wrong date: Date: {04/11/0045 00:00:00} NOTE: dtDateTime.AddSeconds(unixTimeStamp) throws an exception.. my number is in Milliseconds. with this online conversion

Problems with finding the days between two unix timestamps

爱⌒轻易说出口 提交于 2019-12-22 00:28:49
问题 I know there a lot of questions and answers of this already, but unfortunately I think my situation may be unique? For some reason, the time-change seems to be making the day calculate as one day less than it should be calculating. Here is my PHP that I was using and it was working great, until it started to overlap a start and end date that was BEFORE daylight savings, and AFTER daylight savings, respectively (FYI, this is a recent issue, since daylight savings time starts this weekend!): //

Dynamic MySQL partitioning based on UnixTime

微笑、不失礼 提交于 2019-12-21 17:00:11
问题 My DB design includes multiple MYISAM tables with measurements collected online, Each row record contains auto-incremented id, some data and an integer representing unixtime. I am designing an aging mechanism, and i am interested to use MySQL partitioning to partition each such table based on unixtime dynamically. Say that i am interested that each partition will represent single month of data, last partition should represent 2 months, if records arrive for the next not represented month, the

Elegantly check if a given date is yesterday

一个人想着一个人 提交于 2019-12-21 07:26:10
问题 Assuming you have a Unix timestamp, what would be an easy and/or elegant way to check if that timestamp was some time yesterday? I am mostly looking for solutions in Javascript, PHP or C#, but pseudo code and language agnostic solutions (if any) are welcome as well. 回答1: PHP: $isYesterday = date('Ymd', $timestamp) == date('Ymd', strtotime('yesterday')); 回答2: In C# you could use this: bool isYesterday = DateTime.Today - time.Date == TimeSpan.FromDays(1); 回答3: You can use this in C#: bool

How to write bigint (timestamp in milliseconds) value as timestamp in postgresql

ぃ、小莉子 提交于 2019-12-21 07:22:10
问题 I'm trying to store in timestamp with timezone field my value. It is in milliseconds from 1970. select TO_CHAR(TO_TIMESTAMP(1401432881230), 'DD/MM/YYYY HH24:MI:SS.MS') Expected 30/5/2014 11:29:42 10:54:41.230 , but get 22/08/46379 23:27:02.000 回答1: Unix timestamps measures time with seconds, and not milliseconds ( almost everywhere, in PostgreSQL too). Therefore you need to call SELECT TO_TIMESTAMP(1401432881230 / 1000); If you want to preserve milliseconds, call with double precision :

How to write bigint (timestamp in milliseconds) value as timestamp in postgresql

[亡魂溺海] 提交于 2019-12-21 07:21:04
问题 I'm trying to store in timestamp with timezone field my value. It is in milliseconds from 1970. select TO_CHAR(TO_TIMESTAMP(1401432881230), 'DD/MM/YYYY HH24:MI:SS.MS') Expected 30/5/2014 11:29:42 10:54:41.230 , but get 22/08/46379 23:27:02.000 回答1: Unix timestamps measures time with seconds, and not milliseconds ( almost everywhere, in PostgreSQL too). Therefore you need to call SELECT TO_TIMESTAMP(1401432881230 / 1000); If you want to preserve milliseconds, call with double precision :

Same datetime across timezones in browser - on a booking engine

假装没事ソ 提交于 2019-12-21 02:41:23
问题 I'm looking for the best practice/solution to book a service internationally, using same time in any browser. I don't quite get the logic (and dug around here too). Use case user in Brussels booking lets say a haircut service based in Singapore - he is flying there in a week. He picks 14:00 in the browser datetime control. The browser is, however, set to +1 UTC. SG haircut stylist should see the time in his agenda as 14:00 SG time. the barber shop owner is traveling at Dubai, and he wants to