unix-timestamp

How can I generate Unix timestamps?

陌路散爱 提交于 2019-11-27 09:07:10
问题 Related question is "Datetime To Unix timestamp", but this question is more general. I need Unix timestamps to solve my last question. My interests are Python, Ruby and Haskell, but other approaches are welcome. What is the easiest way to generate Unix timestamps? 回答1: In Linux or MacOS you can use: date +%s where +%s , seconds since 1970-01-01 00:00:00 UTC. (GNU Coreutils 8.24 Date manual) Example output now 1454000043. 回答2: in Ruby: >> Time.now.to_i => 1248933648 回答3: In python add the

how to convert a string to a Unix timestamp in javascript?

别等时光非礼了梦想. 提交于 2019-11-27 08:51:10
I want to convert a string "2013-09-05 15:34:00" into a Unix timestamp in javascript. Can any one tell how to do that? thanks. You can initialise a Date object and call getTime() to get it in unix form. It comes out in milliseconds so you'll need to divide by 1000 to get it in seconds. (new Date("2013/09/05 15:34:00").getTime()/1000) It may have decimal bits so wrapping it in Math.round would clean that. Math.round(new Date("2013/09/05 15:34:00").getTime()/1000) try (new Date("2013-09-05 15:34:00")).getTime() / 1000 cumanacr DaMouse404 answer works, but instead of using dashes, you will use

Converting Unix time stamp to dd/mm/yyyy hh:mm:ss

心已入冬 提交于 2019-11-27 08:46:39
问题 I have a column that holds Unix timestamps at C1, and I am looking for the formula to create a new column that converts the timestamp to dd/mm/yyyy hh:mm:ss. Here is a sample of the timestamp: 1409502202 回答1: You are going to have to provide some conversion from the UNIX (aka POSIX) timestamp to an Excel Date format. Typically this is performed by dividing the timestamp by 86,400 (number of seconds in a day) and adding 25,569 (number of days from 01-Jan-1900 to 01-Jan-1970). With a raw value

Convert unix epoch timestamp to TSQL datetime

风格不统一 提交于 2019-11-27 07:51:46
问题 I have found only one similar question but for MySQL. I was working on a web service and had to query the database (MS SQL server). Since I couldn't get the right result I decided to test the query via a SQL client. The web service uses Hibernate to access the DB and all time values are always represented as long values (unix epoch time). In order to test it, I needed to convert the unix timestamp to TSQL timestamp. This is what I came up with: select dateadd(ms,123,'1970-01-01 00:00:00.0');

How to convert unix timestamp (milliseconds) and timezone in R?

早过忘川 提交于 2019-11-27 07:12:01
问题 I have data which has two columns time and timezone that have the timestamp of events. Examples are: time timezone 1433848856453 10800000 It seems like the timestamp has fractional seconds in the information as well. I don't understand the timezone format but it must be an equivalent unix format. I need to preserve the fractional seconds as well. How do I go from that to something like in R? 2015-01-01 13:34:56.45 UTC Note: This human readable date is not the actual converted values of the

MySQL - Convert MM/DD/YY to Unix timestamp

纵饮孤独 提交于 2019-11-27 07:06:28
问题 Is there an easy (single query) way to do this? I'm reading those values from a column in a table and I think that the column itself is defined as a string (can't be helped, i'm afraid). 回答1: Use UNIX_TIMESTAMP; SELECT UNIX_TIMESTAMP('2007-11-30 10:30:19'); Update: SELECT UNIX_TIMESTAMP(CAST(fieldName AS DATE)); 回答2: SELECT UNIX_TIMESTAMP(STR_TO_DATE('08/05/10','%m/%d/%y')); 回答3: SELECT '12/31/10', STR_TO_DATE('12/31/10', '%m/%d/%y'), UNIX_TIMESTAMP(STR_TO_DATE('12/31/10', '%m/%d/%y')) Both

Convert Unix timestamp to Java Date, Spring RequestParam

∥☆過路亽.° 提交于 2019-11-27 06:58:11
问题 Following is a request fullcalendar js send to the server. http://localhost:8080/NVB/rest/calendar/events?start=1425168000&end=1428796800 400 How to specify Date pattern ( @DateTimeFormat ) in Spring Request Param to convert this time to a Date object. I tried different patterns but getting 405 Bad Request. @RequestMapping(value = "/events", method = RequestMethod.GET) public @ResponseBody List<EventDto> addOrder(@RequestParam(value = "start") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE)

What does the 'Z' mean in Unix timestamp '120314170138Z'?

夙愿已清 提交于 2019-11-27 06:34:56
I have an X.509 certificate which has the following 2 timestamps: ['validFrom'] = String(13) "120314165227Z" ['validTo'] = String(13) "130314165227Z" What does the postfix character 'Z' mean. Does it specify the timezone? Yes. 'Z' stands for Zulu time, which is also GMT and UTC. From http://en.wikipedia.org/wiki/Coordinated_Universal_Time : The UTC time zone is sometimes denoted by the letter Z—a reference to the equivalent nautical time zone (GMT), which has been denoted by a Z since about 1950. The letter also refers to the "zone description" of zero hours, which has been used since 1920

DateTime to UnixTime Stamp in .net

浪子不回头ぞ 提交于 2019-11-27 06:20:45
问题 Is there any function in vb dot net to convert datetime to unix time stamp If I google I get only the vice versa but not vb.net to unix time stamp Any help is appreciated 回答1: {Edit} removed old reference link Seconds since Jan 1, 1970 = unix time To get this in VB.NET see below example (in example using DateTime.UtcNow, but you can plug in any DateTime you want there) Dim uTime As Integer uTime = (DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds 回答2: I wrote these at some

Use MySQL to determine whether today is a user's birthday

若如初见. 提交于 2019-11-27 05:45:43
问题 I have all users' birthdays stored as a UNIXtimestamp and am wanting to send out e-mails each day to users that have a birthday that day. I need to make a MySQL query that will get all of the rows that contain a birthday on today's date. It seems like this should be fairly simple, but maybe I am just overcomplicating it. 回答1: This should work: SELECT * FROM USERS WHERE DATE_FORMAT(FROM_UNIXTIME(birthDate),'%m-%d') = DATE_FORMAT(NOW(),'%m-%d') 回答2: Here is an answer that property takes into