unix-timestamp

Convert Unix time with PowerShell

喜夏-厌秋 提交于 2019-11-26 09:59:20
问题 I am parsing an SQLite database using the PowerShell SQLite module, and a couple of the return values are created and modified, both of which are in Unix time. What I would like to do is somehow convert that into \"human time\". I have removed some of the other SQL queries for ease of reading. Import-Module SQLite mount-sqlite -name GoogleDrive -dataSource E:\\Programming\\new.db $cloud_entry = Get-ChildItem GoogleDrive:\\cloud_entry foreach ($entry in $cloud_entry) { $entry.created } The

Convert normal date to unix timestamp

寵の児 提交于 2019-11-26 09:26:39
问题 How can I convert normal date 2012.08.10 to unix timestamp in javascript? Fiddle: http://jsfiddle.net/J2pWj/ I\'ve seen many posts here that convert it in PHP, Ruby, etc... But I need to do this inside JS. 回答1: new Date('2012.08.10').getTime() / 1000 Check the JavaScript Date documentation. 回答2: parseInt((new Date('2012.08.10').getTime() / 1000).toFixed(0)) It's important to add the toFixed(0) to remove any decimals when dividing by 1000 to convert from milliseconds to seconds. The .getTime()

Unix time and leap seconds

回眸只為那壹抹淺笑 提交于 2019-11-26 09:02:19
问题 Regarding Unix (POSIX) time, Wikipedia says: Due to its handling of leap seconds, it is neither a linear representation of time nor a true representation of UTC. But the Unix date command does not seem to be aware of them actually $ date -d \'@867715199\' --utc Mon Jun 30 23:59:59 UTC 1997 $ date -d \'@867715200\' --utc Tue Jul 1 00:00:00 UTC 1997 While there should be a leap second there at Mon Jun 30 23:59:60 UTC 1997 . Does this mean that only the date command ignores leap seconds, while

Convert Unix timestamp into human readable date using MySQL

﹥>﹥吖頭↗ 提交于 2019-11-26 06:18:13
问题 Is there a MySQL function which can be used to convert a Unix timestamp into a human readable date? I have one field where I save Unix times and now I want to add another field for human readable dates. 回答1: Use FROM_UNIXTIME(): SELECT FROM_UNIXTIME(timestamp) FROM your_table; See also: MySQL documentation on FROM_UNIXTIME(). 回答2: What's missing from the other answers (as of this writing) and not directly obvious is that from_unixtime can take a second parameter to specify the format like so:

Python Create unix timestamp five minutes in the future

孤街浪徒 提交于 2019-11-26 06:09:58
问题 I have to create an \"Expires\" value 5 minutes in the future, but I have to supply it in UNIX Timestamp format. I have this so far, but it seems like a hack. def expires(): \'\'\'return a UNIX style timestamp representing 5 minutes from now\'\'\' epoch = datetime.datetime(1970, 1, 1) seconds_in_a_day = 60 * 60 * 24 five_minutes = datetime.timedelta(seconds=5*60) five_minutes_from_now = datetime.datetime.now() + five_minutes since_epoch = five_minutes_from_now - epoch return since_epoch.days

Convert timestamp datatype into unix timestamp Oracle

被刻印的时光 ゝ 提交于 2019-11-26 06:03:49
问题 I have a timestamp datatype in database with format 24-JuL-11 10.45.00.000000000 AM and want to get it converted into unix timestamp, how can I get it? 回答1: This question is pretty much the inverse of Convert Unixtime to Datetime SQL (Oracle) As Justin Cave says: There are no built-in functions. But it's relatively easy to write one. Since a Unix timestamp is the number of seconds since January 1, 1970 As subtracting one date from another date results in the number of days between them you

How to get the unix timestamp in C#

无人久伴 提交于 2019-11-26 06:02:25
I have had look around stackoverflow, and even looked at some of the suggested questions and none seem to answer, how do you get a unix timestamp in C#? bizzehdee You get a unix timestamp in C# by using DateTime.UtcNow and subtracting the epoc time of 1970-01-01. e.g. Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; DateTime.UtcNow can be replaced with any DateTime object that you would like to get the unix timestamp for. Bob As of .NET 4.6, there is DateTimeOffset.ToUnixTimeSeconds() . This is an instance method, so you are expected to call it on

Check whether the string is a unix timestamp

橙三吉。 提交于 2019-11-26 05:30:08
问题 I have a string and I need to find out whether it is a unix timestamp or not, how can I do that effectively? I found this thread via Google, but it doesn\'t come up with a very solid answer, I\'m afraid. (And yes, I cribbed the question from the original poster on the aforementioned thread). 回答1: Ok, after fiddling with this for some time, I withdraw the solution with date('U') and suggest to use this one instead: function isValidTimeStamp($timestamp) { return ((string) (int) $timestamp ===

Date time conversion from timezone to timezone in sql server

删除回忆录丶 提交于 2019-11-26 04:51:23
问题 I having an column of UNIX time stamp in my database table, which comes from a system that is in the Kuwait time zone. My database server\'s time zone is Eastern Time US & Canada . Now I need to convert the UNIX time stamp in to Kuwait time zone date value using an SQL query. Can anyone tell me how I can convert this UNIX time stamp into a Kuwait time zone date value? 回答1: Unix timestamps are integer number of seconds since Jan 1st 1970 UTC. Assuming you mean you have an integer column in

Do unix timestamps change across timezones?

夙愿已清 提交于 2019-11-26 04:40:27
问题 As the subject asks; do UNIX timestamps change in each timezone? For example, if I sent a request to another email the other side of the world saying, \"Send out an email when the time is 1397484936\" , would the other server\'s timestamp be 12 hours behind my own? 回答1: The definition of UNIX timestamp is timezone independent. The timestamp is the number of seconds (or milliseconds) elapsed since an absolute point in time, midnight of Jan 1 1970 in UTC time. (UTC is Greenwich Mean Time