unix-timestamp

How to convert timestamp to date MySQL

旧街凉风 提交于 2019-12-10 17:40:01
问题 I'm following a guide on YouTube on how to make an Image Uploading website, by phpacademy, great guide. However, I'm trying to extend it a bit by displaying it in a human-readable way. At the moment the albums.timestamp is saved on the database as UNIX_TIMESTAMP() and results in 1348372089 for example. Now, if I want to convert these numbers into a regular date and time, such as 23-09-2012 05:00 (European standard), how should I proceed? I have tried DATE(albums.timestamp) and CONVERT(albums

FROM_UNIX alternate in PostgreSQL

北城以北 提交于 2019-12-10 14:31:35
问题 Guys I have stored unix timestamps in my MySQL database, where I was reading them using the MySQL function FROM_UNIX() . Now I'm migrating the database from MySQL to PostgreSQL. In PostgreSQL, how I can read unix timestamps just like I was doing in MySQL with FROM_UNIX() ? 回答1: Taken from the manual: to_timestamp(double precision) convert Unix epoch to time stamp If you need parts of the created timestamp, use the extract function select extract(year from to_timestamp(1284352323)) 回答2: SELECT

MongoDb timestamp

若如初见. 提交于 2019-12-10 03:05:28
问题 i have created and want to now import a dummy collection. one of the fields in each item are "created" and "updated" fields. what can i put in the source/json file so that MongoDb will use the current date and time as the value on import? this wont work "created" : Date() 回答1: mongoimport is intended for importing data existing data in CSV, TSV, or JSON format. If you want to insert new fields (such as a created timestamp) you will have to set a value for them. For example, if you want to set

Get current timestamp from specific timezone

烈酒焚心 提交于 2019-12-09 17:41:32
问题 is there an easy way to get the unix timestamp in javascript from a specific timezone? for example i want the client send me an unix timestamp but i want to get it to match my timezone. thanks! 回答1: Why not simply send the date in UTC, and then convert to your timezone on the server? var utcEpochSeconds = dateObj.getTime() + (dateObj.getTimezoneOffset() * 60000); 回答2: Use toISOString to get a UTC timestamp. var date = new Date(); date.toISOString(); // EST would be 6 hour diff from GMT 回答3:

How can I convert from Gregorian Calendar to Unix Time, in Java?

帅比萌擦擦* 提交于 2019-12-08 14:56:42
问题 I am in need of a method to convert GregorianCalendar Object to Unix Time (i.e. a long). Also need a method to convert Unix Time (long) back to GregorianCalendar Object. Are there any methods out there that does this? If not, then how can I do it? Any help would be highly appreciated. Link to GregorianCalendar Class --> http://download.oracle.com/javase/1.4.2/docs/api/java/util/GregorianCalendar.html Thanks. 回答1: The methods getTimeInMillis() and setTimeInMillis(long) will let you get and set

How to get file creation time in Unix with Perl

时光怂恿深爱的人放手 提交于 2019-12-08 06:31:59
问题 How to get file creation time in unix with perl? I have this command which displays file's last modification time: perl -MPOSIX -le 'print strftime "%d %b %Y %H:%M ".$_, localtime((lstat)[9]) for @ARGV' file.txt 回答1: There is not normally file creation time in UNIX. A new xstat() interface promises support for it, but perl doesn't use it. It is possible to write an XS-based interface to gain access to it. In Perl on UNIX, ctime stands for Inode Change Time, which has nothing to do with file

R: converting JSON time format into POSIX

时光怂恿深爱的人放手 提交于 2019-12-08 01:03:51
问题 I have a JSON character string that I put into a data frame. I am able to do it, but I am having trouble using one of the apply functions to convert all the time character strings into POSIX format. See here for more background on that. The JSON time format is: %h-%m-%dT%H:%M:%S- 2012-01-29T17:00:45-11:00 Lets say I have a data frame as shown: .Close .High .Low .Open Time 1 5.517339 5.539509 5.404098 5.495318 2012-01-30T12:00:45+08:00 2 5.485943 5.521242 5.467357 5.467641 2012-01-30T11:00:45

Convert UNIX timestamp to milliseconds

谁说胖子不能爱 提交于 2019-12-07 16:02:15
问题 How can I use PHP to get a UNIX timestamp like what I get from the JS method .getTime() ? I seem to be having trouble since .getTime() returns milliseconds. I know I have to convert the timestamps first for JS to read it, but how can I do this? Edit: Agreed with the multiply by 1000, but why do I get this?: timestamp: 1305593400 timestamp * 1000: 1.3055934E+12 timestamp: 1305612420 timestamp * 1000: 1.30561242E+12 timestamp: 1305635400 timestamp * 1000: 1.3056354E+12 timestamp: 1304901960

How to get file creation time in Unix with Perl

♀尐吖头ヾ 提交于 2019-12-07 15:08:26
How to get file creation time in unix with perl? I have this command which displays file's last modification time: perl -MPOSIX -le 'print strftime "%d %b %Y %H:%M ".$_, localtime((lstat)[9]) for @ARGV' file.txt There is not normally file creation time in UNIX. A new xstat() interface promises support for it, but perl doesn't use it. It is possible to write an XS-based interface to gain access to it. In Perl on UNIX, ctime stands for Inode Change Time, which has nothing to do with file creation. According to perlport , ctime will be creation time only on Windows, but you might want to use the

rendering Highcharts datatimes on the x axis at regular intervals

三世轮回 提交于 2019-12-07 14:31:49
问题 I have two arrays full of data. One array is just random integers (e.g. 1.7, 2.8, 3.4, etc.) and the other array is a corresponding list of unix timestamps for that data, (e.g. 1366585199). At the moment my Highcharts code looks a little something like this: dataArray = ("2.4","5.6","3.1", ...); timeArray = ("1366585199","1366585233","1366585355", ...) function foo(dataArray, timeArray) { $('#viz_1').highcharts({ chart: { type: 'line' }, title: { text: 'Data Index' }, xAxis: { type: 'datetime