unix-timestamp

Handling time zones in Cocoa

五迷三道 提交于 2019-12-11 14:49:36
问题 I just want to clarify if I am understanding how dates & time zones work. Basically, I have a date string @"2008-07-06 12:08:49" that I want to convert to an NSDate. I want this date and time to be in whatever the current user's time zone is set in. So if they are in GMT or HST, it's still 12:08:49. If I have date in unix form 1215382129 (UTC) and my time zone is set to London (GMT), the outputted date from NSLog() is: 2008-07-06 12:08:49 +0100 If I then change my time zone to Hawaii (HST)

Date time conversion from timezone to timezone in sql server

徘徊边缘 提交于 2019-12-11 14:47:19
问题 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 your

How to convert Regular Date to unixtime in Javascript?

我的梦境 提交于 2019-12-11 14:09:13
问题 How can i convert date which looks like this 12092008 to unixtime like this 1221215809 回答1: You may want to use the following: function covertToUnixTime(yourDate) { return new Date(yourDate.substring(4, 8) + '/' + yourDate.substring(2, 4) + '/' + yourDate.substring(0, 2)).getTime() / 1000; } covertToUnixTime('12092008'); // Returns: 1221170400 回答2: You could use jQuery datepicker's utility functions, parseDate and formatDate. 回答3: This worked for me. var day = $("#day").val(); var month = $("

by month unix timestamp issue

与世无争的帅哥 提交于 2019-12-11 10:40:25
问题 When i pull a monthly report it's only showing entries from the 2nd day of the month up to the day be before the last of the month. For example a report for month of April only shows: 04/02/12 - 04/29/12 What can i modify to show entries: 04/01/12 - 04/30/12 $month = $_GET['month']; if ($services = $db->get_results("SELECT * from vw_newservices where month(from_unixtime(datetime)) = '$month'")) { foreach ($services as $service) { $datetime = date("m/d/y",$service->datetime); Thanks 回答1: From

Need help on unix time stamp

妖精的绣舞 提交于 2019-12-11 08:20:12
问题 Basically, am creating a mailer system to send a mail to my inactive members to do activities in their account if they have not logged in since 30 days. My previous login date stores in my database in unixtimestamp hence I coded as below. select email from myusers where WHERE DATE_ADD(FROM_UNIXTIME(prelogin), INTERVAL 30 DAY) < CURDATE()"; But this code after 30 days it is sending continuos mails almost everyday as I have set cron to run once a day. 回答1: Assuming you only want an email sent

Unable to work with unixtimestamp column type in string data type

若如初见. 提交于 2019-12-11 08:13:44
问题 I have a hive table to load JSON data. There are two values in my JSON. Both have data type as string. If I keep them as bigint, then select on this table gives below error: Failed with exception java.io.IOException:org.apache.hadoop.hive.serde2.SerDeException: org.codehaus.jackson.JsonParseException: Current token (VALUE_STRING) not numeric, can not use numeric value accessors at [Source: java.io.ByteArrayInputStream@3b6c740b; line: 1, column: 21] If I change it two string, then it works OK.

How to convert datetime stamp to unix time in Crystal Reports?

佐手、 提交于 2019-12-11 05:45:00
问题 I need to convert a datetime stamp to Unix time. I understand that this is not the easiest thing to do nor a common thing to do, but I need to do it. I have been searching for how to do this for a few hours. 回答1: It turns out that you can use datediff("s", date("1970-01-01 00:00:00"), {date_column}) to get the unix time stamp in Crystal. 来源: https://stackoverflow.com/questions/20435775/how-to-convert-datetime-stamp-to-unix-time-in-crystal-reports

how to use curdate() in where clause against unixtimestamp (bigint) column

ぐ巨炮叔叔 提交于 2019-12-11 05:37:18
问题 I am trying to pull records in the past 7 days. This is my select statement that I have been trying to get to work: select from_unixtime(time,'%m/%d/%y') as fdate, from_unixtime(time,'%h:%m:%s') as ftime from mdl_log where from_unixtime(time,'%y-%m-%d') between curdate() and curdate() - INTERVAL 7 DAY I have tried various incarnations of the where clause like where time between curdate() and curdate() - INTERVAL 7 DAY and where from_unixtime(time,'%yyyy-%mm-%dd') between curdate() and curdate

float to unix epoch

≡放荡痞女 提交于 2019-12-11 05:32:49
问题 I am pulling data from an JSON database that is storing the time in unix epoch but for some reason the numbers are being floated when I'm pulling them out. This is something I've never had to deal with before. So basiclly a number like 1293083730000 is showing up as 1.293085408E+12 I need to get the number back to the epoch time so I can compare it to the current time. Any help would be great. 回答1: That's engineering notation, a convenient method of writing large numbers. The number is still

Unexplained zero added when going from java.util.Date to java.sql.Timestamp

折月煮酒 提交于 2019-12-11 04:59:44
问题 Consider the following test code (Try it here yourself on ideone.com - an online Java compiler): class Main { public static void main (String[] args) throws Exception { Main m = new Main(); m.test1(); System.out.println(); m.test2(); } void test1() throws Exception { System.out.println("TEST 1: "); String strTimestamp = "1957-04-27 00:00:00.01"; System.out.println(strTimestamp + " [Original String]"); String format = "yyyy-MM-dd HH:mm:ss.SS"; System.out.println(format + " [Format used]");