utc

squeryl date to long conversion

社会主义新天地 提交于 2019-12-12 02:28:03
问题 I want to store java.util.Date (or Timestamp) as an int (or Long) in my db using Squeryl. I'd like to control how the date is transformed to the number and vice versa. How can I achieve this? I'm pretty new to scala/squeryl, coming from java/hibernate. Back in java/hibernate I could create user types and either register them globaly or use them localy on a field with an annotation. This user type defined methods for how to persist the object type to db and how to load it from the db. I read

How to convert datetime on a per user basis

谁都会走 提交于 2019-12-12 02:25:12
问题 I have left my application.rb as it was and by default it is storing datetime in UTC. Now at the UI level (for displaying only) I want to convert the datetime to the user specific timezone. How can I convert the UTC datetime I get from postgresql and then convert it to the timezone that I will store for each user. I want to make this conversion using the Offset so like: -5:00 or +4:00 Is it ok to do this, because I was just checking some locations and it seems their offset changes during the

Not able to parse UTC date time to EST local time [duplicate]

…衆ロ難τιáo~ 提交于 2019-12-12 02:13:41
问题 This question already has answers here : How to Parse Date in ISO format in Java? [duplicate] (2 answers) Closed 3 years ago . Getting following exception while parsing UTC date time to EST local time. Exception: Stacktrace:] with root cause java.text.ParseException: Unparseable date: "2016-09-09T03:00:29Z" at java.text.DateFormat.parse(DateFormat.java:357) at com.study.crud.util.GenericUtils.convertUTCDateToEST(GenericUtils.java:55) GenericUtils.java public static String convertUTCDateToEST

SQLSTATE[HY000]: General error: 1298 Unknown or incorrect time zone: 'UTC' windows

≯℡__Kan透↙ 提交于 2019-12-12 02:12:55
问题 I am getting this error while setting up a PHP source code in Windows Wamp server. SQLSTATE[HY000]: General error: 1298 Unknown or incorrect time zone: 'UTC' Please let me know how to solve. Thanks. 回答1: You have three ways to solve this problem. Install the timezone database The mysql_tzinfo_to_sql program loads the time zone tables in the mysql database. It is used on systems that have a zoneinfo database (the set of files describing time zones). Examples of such systems are Linux, FreeBSD,

NSDate dateWithTimeIntervalSince1970 NOT returning GMT/UTC time

China☆狼群 提交于 2019-12-12 01:45:08
问题 I tried an experiment because I need to be able to generate a unix timestamp (since 1970) in the app I am working on. NSLog(@"Getting timeIntervalSince1970"); double theLoggedInTokenTimestampDateEpochSeconds = [[NSDate date] timeIntervalSince1970]; This should've returned epoch seconds (since 1970) in GMT (Seconds since Jan 1, 1970). However, when conducting the experiment at at Mon Aug 15 09:54:30 2011, it returned 1313427270.504315 Testing this with a simple perl one-liner on my Mac OS

get date string from utc unixtime and add a timezone offset

↘锁芯ラ 提交于 2019-12-12 01:38:55
问题 I would like to generate in JS a Date object (or XDate) starting from a UTC unix timestamp, add a timezone offset and then generate a String in the format "yyyy-MM-dd HH:mm:ss". For now I did this: createServerRelativeTs : function(unixtimeutc, utcoffset) { var stimeUTCoffset = (isNaN(utcoffset)) ? 1 : utcoffset; var time = new XDate(Math.round(unixtimeutc * 1000)); var hours = time.getUTCHours() + stimeUTCoffset; time.setUTCHours(hours); return time.toString("yyyy-MM-dd HH:mm:ss"); } in

How to Change time format of date string using timeoffset [duplicate]

筅森魡賤 提交于 2019-12-12 01:22:06
问题 This question already has answers here : Strange Java Timezone Date Conversion Problem (3 answers) Closed 10 months ago . I am trying to convert date string to UTC format from another time zone in Java. we have only time zone offset like "-06:00". Can any one help me how to convert the date time to UTC format using time zone offset. Thanks This for java version 1.7 . I have tried with following snippet but receiving the same input as output. String dateInString = "02/04/2019 18:17:15";

3.in.pool.ntp.org sometimes fails to return date in android device

陌路散爱 提交于 2019-12-12 00:17:27
问题 I am fetching UTC date from ntp servers from a long time now. But I have noticed that I am getting empty string sometimes(once in 100 times) as I run my code. My code is DateFormat outputFormat = new SimpleDateFormat("dd-MM-yyyy"); SntpClient client = new SntpClient(); if (client.requestTime("3.in.pool.ntp.org", 10000)) { Date actualD = new Date(client.getNtpTime()); actualDate = outputFormat.format(actualD).trim(); } Can u suggest me some situation where this code has its limitations. And

How to save UTC (instead of local) timestamps for Hibernate Envers revision info?

杀马特。学长 韩版系。学妹 提交于 2019-12-12 00:12:05
问题 Using Hibernate/Envers, how to: Save UTC (instead of local) timestamps for Hibernate Envers revision info? Get timestamps as a LocalDateTime (Java 8)? 回答1: 1) From the revision listener, call the fixTimezone method of the revision, as shown below. 2) To get it as LocalDateTime use the getRevisionDate method, as shown below. public class MyRevisionListener implements RevisionListener { @Override public void newRevision(Object revisionEntity) { MyRevision revision = (MyRevision)revisionEntity;

Convert unix time to UTC datetime

人盡茶涼 提交于 2019-12-11 18:38:11
问题 I'm trying to insert a timestamp into the database, I need the timestamp to be in UTC time, not the server's time zone. INSERT INTO my_table SET time = FROM_UNIXTIME(:epochTime) But the newly inserted datetime value is not in UTC time, how can I do this? Perhaps I should also use CONVERT_TZ, but I don't know the timezone from which I convert. 回答1: Yup I would look at CONVERT_TZ: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_convert-tz To grab the timezone from