FAQ Database Discussion Community


Determine whether timestamp is 50 seconds ago [closed]

php,timestamp
How to know if $database_row_datetime is 50 seconds ago? For example: if $database_row_datetime is 50 seconds ago { echo "This post was sent now"; } Here is my timestamp variable: var_dump($database_row_datetime) => string(19) "2015-04-28 15:20:09" ...

Is there any way to find out when an album got added to spotify with the web api?

javascript,api,web,timestamp,spotify
My usecase is to present the latest added album of an artist (regardless of releasedate). I use the https://api.spotify.com/v1/artists/[artistId]/albums to get the albums but I can't find any information about how the response is ordered. Is it random or actually sorted by the date the album got added to spotify?...

Add two hours to timestamp

sql,oracle,plsql,timestamp,intervals
I've got a trigger that has to set a timestamp to the current time plus two hours when the field is null before insert. One of the statements I tried so far is IF :new.time_to_live IS NULL THEN :new.time_to_live := sysdate + INTERVAL '0 02:00:00.0' HOUR TO MINUTE; END IF;...

PHP Checking if user is online

php,date,datetime,timestamp
I don't fully understand the PHP time functions, but I'm under the impression my function should work: function user_status($timestamp){ $online = date('Y-m-d H:i:s', strtotime('-5 minutes', strtotime(date('Y-m-d H:i:s')))); $away = date('Y-m-d H:i:s', strtotime('-15 minutes', strtotime(date('Y-m-d H:i:s')))); $offline = date('Y-m-d H:i:s', strtotime('-30 minutes', strtotime(date('Y-m-d H:i:s')))); if(strtotime($timestamp) >= $online){ return 'online'; } else...

Convert timestamp into time() [duplicate]

php,date,timestamp
This question already has an answer here: How to convert date to timestamp in PHP? 16 answers I want to convert a timestamp from mysql to format as time(). IF i have this date: 2015-06-05 08:53:30 I wants to convert to something like: 1433491545 I have to use the...

How can I format my timestamp right?

php,mysql,date,timestamp
I have a timestamp from the mySQL database and I would like to format it. $date = $row['date']; $date = date("F j, Y, g:i a"); My problem is now that it prints not the date of the database. Instead it prints out the current date. But this is not what...

Macro __TIMESTAMP__ gets stuck

c++,timestamp
Hi, I'm currently working on a project that has it's own logging system, written years ago, and it uses __TIMESTAMP__ to print the current date and time. What I've noticed is that sometimes, this macro gets stuck, and keeps returning the same value over and over again. For example...

Creating timestamp based on time : PHP

php,timestamp
I have to create timestamp for 8 PM everyday to compare it with some timestamp in database. How can I create it? $ts = '2015-05-12 12:00:20' is what I have stored in database. I need this $ts_8pm = '2015-05-12 20:00:00' so that I can take some action when this meets....

Extend dataframe by adding start and end date and fill it with timestamps and NaN

python,pandas,timestamp
I have got the following data: data timestamp 2012-06-01 17:00:00 9 2012-06-01 20:00:00 8 2012-06-01 13:00:00 9 2012-06-01 10:00:00 9 and would like to sort it descending by time, add a start and end date on top and bottom of the data, so that it looks like this: data timestamp...

CodeIgniter - MySql timestamp/datetime keep giving me zeros when inserting

php,mysql,codeigniter,datetime,timestamp
I am current using CodeIgniter 2.2.2 and I have the following code inside my modal: $this->createDate = time(); $this->db->insert('someDB_Table', $this); Where my createDate type is a timestamp (i also tried datetime). But this is giving me all zeros when inserting inside DB. Is there other way to get around this?...

How to increase the EXT4 timestamp precision in linux?

linux,timestamp
Timestamp precision or accuracy of EXT4 filesystem in Linux is one second ( Windows timestamp precision is 100 nano second ). But our application which is running on cloud requires more precision for the filesystem . How to increase the timestamp precision in Linux ?

Get the time in Javascript

javascript,php,jquery,time,timestamp
I would like to get the current time in Javascript/ Jquery. I could just use Math.floor($.now() / 1000) but that will return the time from the browser which could be accurate but possibly in the wrong timezone. I have setup the file time.php on my server which when visited returns...

How to specify timestamp along with date in postgresql

sql,timestamp,postgresql-9.3
I would like to specify a static timestamp along with dynamic date in postgresql I am using now()-1 to get date. I am not sure how to specify static timestamp The format should be 2015-06-12 20:45:00:00 Now I am using select now()-1 from dual to get previous date....

How can I get todays timestamp at 4pm?

javascript,date,datetime,time,timestamp
I am looking for a way to receive the timestamp of today's 4pm in JavaScript. When I use this code Math.floor(Date.now() / 1000); it give me the current timestamp. How can I specify just the hour to be static, the rest to rely on the current day?...

Get comments after the timestamp given

ruby-on-rails,ruby,timestamp,mongoid
I'm following Ryan's tutorial in polling comments and works perfectly but on polling the data he used id to get only the latest comments. How can I use the timestamp to poll the latest comments only Here's a gist link for model,controller,view,coffeescript https://gist.github.com/silvercrow27/e08c0142af43aec39f02...

what are the cons of using unix timestamp as an order ID?

php,mysql,unix,timestamp
I am designing a shopping project and am thinking about using the unix timestamp as the order ID. I know I can use mySQL incremental numbers to use as order ID like 10001, 10002, etc. but I don't want everybody to know how many orders there really are. Is this...

Given a microsecond value , how to accurately get a timeval struct? /*UPDATE GETTING NEGATIVE VALUE*/

c++,timestamp,double,rounding
Is this the right way to convert a microseconds and represent it as a timeval in my application ? I require the usage of a struct timeval and the above code is part of a routine that converts a double microsecond to a timeval NEGATIVE Value in this code //UPDATE...

Last run time of shell script?

shell,unix,timestamp,ksh,sunos
I need to create some sort of fail safe in one of my scripts, to prevent it from being re-executed immediately after failure. Typically when a script fails, our support team reruns the script using a 3rd party tool. Which is usually ok, but it should not happen for this...

Fix bad commit dates

svn,timestamp
I'm trying to import to phabricator a subversion repository and I'm found that there a lot of commits with wrong dates. This dates are set on the future, like 3905-05-22 . If there a few, I could be changing it by hand, but I found that there too many. There...

pdo insert statement using datetime errors

php,mysql,pdo,timestamp
I have a table with a field with type as TIMESTAMP On my webpage i have two fields and the values being sent out are as follow. $eDate = "Wed, 01 Apr 2015"; $eTime = "11:35 pm"; Using the following code i am trying to insert the values in the...

Find the closest timestamp SQL?

mysql,sql,phpmyadmin,timestamp
I have two tables that look like this: Communication: (Calls made) Timestamp FromIDNumber ToIDNumber GeneralLocation 2012-03-02 09:02:30 878 674 Grasslands 2012-03-02 11:30:01 456 213 Tundra 2012-03-02 07:02:12 789 654 Mountains Movement: Timestamp IDNumber Type X Y 2012-03-02 11:02:30 379 pedestrian 32 46 2012-03-01 12:32:41 654 pedestrian 54 56 2012-03-02 07:02:16...

Access the time stamp of a HTTP request in Node.js

node.js,express,request,timestamp
Is there a way to access the time stamp of when a HTTP request is sent to a Node.js server? Something like: app.post('', function (req, res) { console.log(req.date); //or console.log(req.timestamp); } I tried out several things and already printed out the whole req object to the console, but didn't find...

Oracle : Search between two Timestamps is not working

oracle,timestamp,between
I am trying query the records between two timestamp in oracle. Timestamp value in db is "02-JUL-14 02.24.04.000000000 PM" select * from event_detl where START_DT between to_timestamp('02-07-2014 02:24:03', 'dd-mm-yyyy hh24:mi:ss') and to_timestamp('02-07-2014 02:24:05', 'dd-mm-yyyy hh24:mi:ss') Currently above query is not returning any record though record exists.Please help....

SQL Server Query Performance with Timestamp and variable

sql-server,performance,timestamp
I have a simple SQL query to count the number of telemetry records by clients within the last 24 hours. With an index on TimeStamp, the following query runs in less than 1 seconds for about 10k rows select MachineName,count(Message) from Telemetry where TimeStamp between DATEADD(HOUR,-24, getutcdate()) and getutcdate() group...

Preventing Matlab from truncating timestamp when importing from excel

matlab,timestamp
I am importing an excel file of timestamps into Matlab. It seems that whenever I have a timestamp at the turn of midnight i.e. '13/5/2015 12:00 PM', my matlab will read it as only '13/5/2015' only. Excel samples '13/5/2015 12:00 PM' '13/5/2015 12:01 PM' Imported to Matlab using [NA1, NA2,...

How to get tomorrow's, or the upcoming week's events, using query function?

date,google-spreadsheet,timestamp
I have a list of events and their dates. I can use the below formula to get today's (well sort-of as it is incorrectly filtering the date) information. =query(A:B, "Select * Where toDate(A) = todate(now())") Now I would like to show the events for the entire upcoming week but the...

how I can extract data between now and the end of the current date? Postgres

postgresql,timestamp,range
I need to extract the last hundred calls from now until the end of the current date ejm: select * from call where create_at between >= yyyy-mm-dd 00:00:00 and <= yyyy-mm-dd 23:59:59 limit 100 how i can to extract the data between this range?...

How can I get the corret date using the function strtotime in php?

php,date,timestamp,strtotime
I have this function in php: private function setInfoTareasDiarias($aDataTarea,$idUsu,$seccion){ print_r($aDataTarea['fecha']); $date=date("Y/m/d 00:00:00", strtotime($aDataTarea['fecha'])); $aData['porcentaje']=$aDataTarea['porcentaje']; $aData['fecha_termino']=$date; $aData['descripcion']=$aDataTarea['descripcion']; $aData['id_tarea']=$aDataTarea["idTarea"]; $aData['id_seccion']=$seccion; $this->aDatosInfoTareasDiarias[]=$aData; print_r($this->aDatosInfoTareasDiarias); } print_r($aDataTarea['fecha']); print...

PHP - Turn mysql time-stamps into display grid

php,mysql,timestamp
I am quite stuck on this one. I have a MySQL db full of "reservations", and I am trying to build a grid to display availability of appointments. For each entry, I have a start time and end time in the format of: YYYY-MM-DD HH:MM:SS (i.e. 2015-06-17 12:00:00). I am...

Cannot correctly format a java.sql.Timestamp(yyyy-MM-dd HH:mm:ss.S) to string

java,string,timestamp
I try to format date = 2015-05-07 10:12:14.000243 to equivalent string this: new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").format(date); But I getting wrong value: 2015-05-07 10:12:14.0 Can you help me? Thanks....

PHP countdown serverside cache

php,caching,timestamp,server
Hello my dear fellow programmers. I have a problem. I'm trying to fetch a difference between the current timestamp and an arbitrary timestamp from our database using the sever-sided language PHP, initializing a client-sided JavaScript countdown timer. However, the cache on the files makes it kind of hard. For this...

Setting a column as timestamp in MySql workbench?

mysql,sql,timestamp,mysql-workbench
This might be a really elementary question, but I've never created a table with TIMESTAMP() before, and I'm confused on what to put as the parameters. For example, here: I just randomly put TIMESTAMP(20), but what does the 20 as a parameter signify here? What should be put in here?...

“Syntax error or access violation” when inserting dates using PDO and SQL Server

php,sql-server,pdo,timestamp
I am trying to add two simple strings and one date to a SQL Server using PDO in PHP. I'm currently using the following code to do so: $data = array( 'Omschrijving' => 'Mijn mooie omschrijving...', 'Toelichting' => 'Mijn leuke toelichting...' ); # Insert data $STH = $DBH->prepare("INSERT INTO memo...

Error while trying to insert data using plpgsql

postgresql,timestamp,plpgsql
I have the following plpgsql function: CREATE OR REPLACE FUNCTION test_func(OUT pid bigint) RETURNS bigint AS $BODY$ DECLARE current_time timestamp with time zone = now(); BEGIN INSERT INTO "TEST"( created) VALUES (current_time) RETURNING id INTO pid; END $BODY$ LANGUAGE plpgsql; select * from test_func(); The above gives an error: column...

elixir, ecto, compare time in the where clause

timestamp,elixir,ecto
When I create a query using ecto in Elixir, I'm not really sure about how to compare time in the 'where' clause. In the schema part I declare create_at as :datetime schema "tenant" do field :id, :integer field :created_at, :datetime # timestamps([{:inserted_at,:created_at}]) end and the query part is like def...

Number of days between two time stamps

php,timestamp
How can I calculate the number of days between two times, I have a one time field in my table name active_time, following is the code I have tried but it gives me number value around thousands whereas I have queried for number of days: $now =strtotime("now"); // Current time...

Timestamp and UTC kind

c#,date,datetime,timestamp,utc
In my application i receive Time stamp and in c# code I convert into date and pass this date to execute the stored procedure .My application is placed in server machine. But when this date is printed in log i saw the date is receiving in server one day less....

Is it possible to use a timestamp in ms since epoch in select statement for Cassandra?

cassandra,timestamp,cql
I know that using the formats listed here (http://docs.datastax.com/en/cql/3.0/cql/cql_reference/timestamp_type_r.html) work to query cassandra. However, I'm having a hard time determining if it is even possible to use ms since epoch in the select statement. I feel like it should since it data can be sent to cassandra in the ms...

How to compare timestamps in MySql table and select older than given time period [closed]

mysql,date,timestamp,date-format
Timestamps and date formats were allways puzzling me a little bit. Let's say we have a MySql table where date column is in timestamp format. I'd like to ask what is the easiest or simplest way how to find all table rows older than, for example 1 week....

UDP receiving - precise time when packages arrive in C#

c#,sockets,udp,timestamp,udpclient
Is there way to know precise time when packages arrives to buffer with UDP protocol in C# (windows 7)? I tried somethings like this: while(true) { UDPclient.Receive(ref remoteEp); Console.WriteLine(System.DateTime.Now.TimeOfDay.ToString()); } I got wrong result. Some of packages arrive very close, some too far from each other. Wireshark gives correct timestamp,...

List files and timestamp of creation on AIX system (Perl)

perl,timestamp,aix
I want to perform a command like ls -l --time-style="+%s" on an AIX system. I only need the timestamp of the file and the filename. With this answer, I made: find . -type f -exec perl -le 'print((stat shift)[9])' {} \; But I can't find a way to print the...

SUM of two timestampdiff in minutes

mysql,timestamp,sum
I've searched through many sites but was unable to find a solution to this. I'm trying to sum two timestampdiffs when they are in minutes: SELECT COUNT(*) from `table` WHERE TIMESTAMPADD(MINUTE, TIMESTAMPDIFF(MINUTE,first_date,second_date), TIMESTAMPDIFF(MINUTE,fourth_date,third_date) ) > 15 AND status='Pending' This is where I am currently at but it returns an empty...

MySQL get records between now and a month last year

php,mysql,sql,date,timestamp
I am trying to create an SQL query to select records where the timestamp is less than NOW() but is greater than september last year, but i dont want to specify the year by putting something like: date > '01/09/2014' If i were to run the query today it should...

Persisting DateTime when saving/updating entities in fluent nhibernate

c#,nhibernate,timestamp,fluent
I'm trying to persist the datetime of creation and update of entites (not relevent to versioning and concurrency) using fluent nhibernate. To achieve this using nhibernate I would write this mapping tag: <timestamp name="Timestamp" access="property" unsaved-value="null" /> How can I make fluent nhiberbate generate that mapping tag?...

How do I get timestamp interval in swift?

ios,swift,timestamp
I saw this answer : Get current time in timestamp format - iOS But for some reason it gives me errors. What I need is to be able to specify the timestamp between now and in the next 2 minutes, or interval between last 2 minutes and now. Eg: interval...

Average Hour of Day in Teradata

sql,datetime,timestamp,teradata
I have a table with hundreds of timestamps. I extract the hour, then I can simply average that, however, this is where I get issues. select purchase, CAST(AVG(EXTRACT(HOUR FROM opened_at)) AS INT) as average_open from db.purchasetable group by 1 When I average hour 22 and hour 2 I get 12(obviously),...

Custom format DateTime to Timestamp

php,datetime,timestamp
I have made many searches for a simple function to convert custom DateTime to Timestamp, But I didn't get the exact solution: The DateTime str is: $dt = "14-05-2015 18:21"; (Day-Month-Year Hour:Minute) (not the standard DateTime format) Is there a simple function to convert this string to timestamp? Thanks....

How to show date once per day from an array with multiple timestamps

javascript,jquery,arrays,angularjs,timestamp
I have an array with multiple conversations and with every message that has been typed either by the user or by the admin a timestamp indicating at what time the message was sent. A conversation can end on the same day or it can continue the day after it was...

Force MySQL to update TIMESTAMP column

mysql,timestamp,auto-update
I believe I have set my 5.6.17 ver MySQL server to recognize IANA TZ Databases as evidenced by a system_time_zone variable being set to "Pacific Daylight Time" a time_zone variable being set to UTC NOW(), giving me a standard SQL format date time I thought that that would be sufficient...

php my admin default Timestamp is wrong even if I use correct timezone

php,timestamp,default
I am experiencing problem in default timestamps I have this column name dateCreated type is TIMESTAMP and default as CURRENT_TIME whenever I insert a new row in my add member page the time generated is late for 2 hrs. I currently live in ASIA/MANILA which is GMT +8. I tried...

how to convert received datetime object to timestamp in php?

php,datetime,timestamp
I receive from POST the datetime object (eg. 30/06/2015 02:04 PM). I need to use it later in my php code as a timestamp, so the variable $begin_timestamp = $_POST['date']; would contain a timestamp instead of this date time. How can I quickly change it at that point?

Logstash timestamp issue - the parsed value is one hour behind the log value

timestamp,logstash,timezoneoffset
I am using the following code to read McAfee Logs ( I chose to use CSV filters because grok filters turned out to be messy) input { stdin{} } filter { csv { columns => ["timestamp", "McAf_ThreatSeverity", "McAf_Event", "McAf_EventDescription", "McAf_EventCategory", "McAf_ThreatT$ separator => "|" } date { locale => "en"...

Get Time stamp using Java GMT+5:30

java,date,datetime,time,timestamp
I want Timestamp of given date. using this code public static String getTimestamp(String time) { DateFormat dfm = new SimpleDateFormat("dd-mm-yy hh:mm:ss"); long unixtime = 0; dfm.setTimeZone(TimeZone.getTimeZone("GMT+5:30")); try { unixtime = dfm.parse(time).getTime(); unixtime=unixtime/1000; } catch (ParseException e) { e.printStackTrace(); } return ""+unixtime; } public static void main(String[] args) { System.out.println(getTimestamp("11-05-15 11:54:55"));...

Get n data based on the same day (timestamp)

mysql,timestamp,date
I have this table "sensor" which has these fields : id (int,PK) timestamp (timestamp) latitude (varchar) longitude (varchar) data (float) As in one query I want to get 5 rows that were on the same day. Please note that it's not current date and the data has lots of different...

How do I check file timestamp attributes in Perl 6?

perl,timestamp,perl6
In Perl 5, you can use stat to get the accessed, modified, and changed timestamps of files. For example: my $filename = "sample.txt"; my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = stat($filename) print "File '$filename' was last accessed $atime seconds since the epoch.\n"; Which results in: File 'sample.txt' was last accessed 1431707004 seconds since...

How do I find the time difference between two timestamps?

php,timestamp,difference
Let's say I have two mongo dates. $a = $mongoDateA->sec; $b = $mongoDateB->sec; So now I have two timestamps to compare, but I need to figure out, if dateB is any later than a day more than dateA. so if the difference between the two dates is 1 day, I...

How Yii2 data provider can return results for last 24h

php,mysql,timestamp,yii2,dataprovider
I need to return results from database table only where updated_at field is not older than 24h. Inside my index action I have this code: $dataProvider = new ActiveDataProvider([ 'query' => SearchStats::find(), 'pagination' => [ 'pageSize' => 10, ], ]); How can I modify this code to return me results...

Is timezone info redundant provided that UTC timestamp is available?

datetime,time,timezone,timestamp,timestamp-with-timezone
I have a simple mobile app that schedules future events between people at a specified location. These events may be physical or virtual, so the time specified for the event may or may not be in the same timezone as the 'location' of the event. For example, a physical meeting...

NSIS : Aborting creation process

timestamp,nsis,sign
I want to create an installer with signing without time stamp as my code below. But the build failed, aborting creation process in line: !system "$\"${SIGNTOOL_PATH}$\" sign /f $\"${KEY_PATH}$\" /p ${PASSWORD} /d $\"${FULL_NAME}$\" /du $\"http://www.companywebsite.com$\" $\"$%TEMP%\uninstall.exe$\"" = 0 So I commented this line and make build it again, then I...

Exporting from oracle database to csv file

java,oracle,csv,timestamp
import java.io.*; import java.sql.*; public class CsvF { public static void main(String[] args) { try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection conn= DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","sandp"); conn.setAutoCommit(false); Statement st=conn.createStatement(); ResultSet rs=st.executeQuery("select * from tet where to_char(S_DATE,'HH24') = '23'"); ResultSetMetaData rsmd = rs.getMetaData(); FileWriter cname = new FileWriter("D:\\asd.csv"); BufferedWriter bwOutFile = new...

PostgreSQL how to set a Primary Key column with timestamp to automatically be filled

timestamp,postgresql-9.1
How could I achieve this in PostgreSQL?? I want to have a table with a timestamp field that automatically gets the value of now() on insert. The timestamp will never be updated. I assume I need to create a trigger to do this. If there is an easier way, please...

Ruby - Convert formatted date to timestamp

ruby,date,time,timestamp
I need to convert a date string to the Unix timestamp format. The string I get from an API looks like: 2015-05-27T07:39:59Z with .tr() i get: 2015-05-27 07:39:59 which is a pretty regular date format. Nonetheless, Ruby isn't able to convert it to Unix TS format. I tried .to_time.to_i but...

Eloquent model not updating updated_at timestamp

php,laravel,timestamp,eloquent
I'm using Laravel 5.1. To make it simple, I have the following code Migration: Schema::create('sitemap_data', function (Blueprint $table) { // Primary and foreign keys $table->increments('id'); $table->string('postUrl'); // Database functions $table->timestamps(); }); And this is the code somewhere else I'm using $sitemapData = SitemapData::firstOrNew([ 'postUrl' => $post ]); $sitemapData->save(); Now, according...

Subtracting dates Javascript

javascript,jquery,timestamp,milliseconds
I've been trying to format my timestamps into the facebook/twitter style where it shows 1 second, 1 day, 1 month, 1 year and so on. However for some reason it's not returning the right values back and i'm not sure why? Below I've made a copy of the code I'm...

Can tornado set_secure_cookie expires timestamp?

timestamp,tornado
I check tornado set_secure_cookie function code, it can set cookie in expires_days, but I want to know whether it can be set expires in timestamp form. For example: self.set_secure_cookie("cookie_name", "cookie_value", expires=timestamp) timestamp is value like 1432527031. Could somebody answer me?...

Retrieve only today records from MySQL database using PHP

php,mysql,timestamp
In my database I stored date and time as a TIMESTAMP values. I want to retrive only today data from the database. This is code that I tried $today = date("Y-m-d") . '00:00:00'; $last = date("Y-m-d") . '23:59:59'; $sql = "SELECT id, name, name2,some,some,submittimestamp,some FROM recs where submittimestamp Between $today...

PHP datetime to timestamp

php,timestamp
I want to convert my date time which is in this format 2015-05-11T18:30:00+05:30 and I want to convert this to timestamp. I have tried this code $time = $event->start['dateTime']; // return 2015-05-11T18:30:00+05:30 echo date_timestamp_get($time); But getting this error Warning: date_timestamp_get() expects parameter 1 to be DateTime How I can fix...

Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

mysql,timestamp
I always get the error: Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause DROP TABLE IF EXISTS `characters`; CREATE TABLE `characters`( `id` int(11) NOT NULL AUTO_INCREMENT, `accId` int(11) NOT NULL, `charId` int(11) NOT NULL, `charType` int(11) NOT NULL, `level` int(11)...

Gnuplot lc palette not working with timefmt

timestamp,gnuplot,palette
I am plotting a graph with regular variables on the x and y axis and I want the line to change color with respect a time variable. I have tried using lc palette after defining one and even the colorbox appears but the line doesn't change color. I also tried...

java.time.Instant -> java.sql.Timestamp behaving differently on Windows vs *nix (timezone-related)

java,hibernate,timestamp,jodatime,java-time
Somewhere in the code I have Timestamp ts = Timestamp.from(instant); where instant is, as the name suggests, java.time.Instant. (Why? To allow Hibernate 4.x to persist, via a UserType, JDK8 time types, not yet supported before Hibernate 5). In fact, let me put the code so it's clear. The log statement...

GetTime doesn't correctly display zero's

java,time,timestamp
I use TimeStamps in my system. Everything works correctly, however I find it annoying to have [12:2:2] as TimeStamp. Because you don't know if it's 20 or 2. I am tired and sick, and starting to think it is the compiler. java.util.Date date= new java.util.Date(); Timestamp time = new Timestamp(date.getTime());...

Sort scala arrayBuffer of TimeStamp

scala,timestamp
I have this function: def getTime() : ArrayBuffer[Timestamp] = { val offset = Timestamp.valueOf("2015-01-01 00:00:00").getTime() val end = Timestamp.valueOf("2015-01-02 00:00:00").getTime() val diff = end - offset + 1 val mList = ArrayBuffer[Timestamp]() val numRecords = 3 var i = 0 while (i < numRecords) { val rand = new Timestamp(offset...

What is the default timestamp value in php and where we need to change on core?

php,date,timestamp
I checked in my localhost where date_default_timezone_get() function returns 'UTC', I thought it will took the current server's timezone. If not Where this default setting can be managed in PHP without using date_default_timezone_set() function to set manually? Thanks in advance...

select values of a specific month from table contain timestamp column

sql,postgresql,timestamp
For example I have a following table(tbl_trans) like below transaction_id transaction_dte integer timestamp without time zone ---------------+---------------------------------- 45 | 2014-07-17 00:00:00 56 | 2014-07-17 00:00:00 78 | 2014-04-17 00:00:00 so how can I find the tottal no.of transaction in 7th month from tbl_trans ? so the expected output is tot_tran...

Get correct epoch time from client even if time on client is wrong

javascript,timestamp,countdowntimer,epoch
I am building a real time web app that requires epoch time from client. The calculation is involving a timestamp coming from my server and the timestamp from the client. I use the following code to get the epoch timestamp from client using JS: var milliseconds = Math.floor((new Date).getTime()/1000); JS...

Adding a date()/timestamp to each MongoDB item upon creation

javascript,node.js,mongodb,io,timestamp
this is my second question today regarding Node.js. It's late, and I'd like some help to quickly integrate this function before I can go to bed. I have a small Q&A app in which I can read and write data from/to MongoDB on my views pages. However, I'd like to...

Oracle timestamp and current_date

oracle,timestamp
I have this code working: ixdtl.timestamp between to_date('2015/06/03', 'YYYY/MM/DD')+ INTERVAL '03:0:0.0' HOUR TO SECOND AND to_date('2015/06/03', 'YYYY/MM/DD')+ INTERVAL '1 2:59:59.99' DAY TO SECOND AND ( icrun.RUNDATE BETWEEN to_date('2015/06/03', 'YYYY/MM/DD') AND to_date('2015/06/03', 'YYYY/MM/DD')+ INTERVAL '1' DAY ) But now, in place of the string '2015/06/03', I need to use the variable...

SQL - How to get a range of timestamps using BETWEEN (mysql)?

mysql,sql,timestamp
So for example, if I had two tables, communication and movement that both have a columns named ID and timestamp, and I had a query that generally looked something like this: SELECT * FROM movement m JOIN communication c ON m.ID = c.ID WHERE m.timestamp <= c.timestamp ORDER BY abs(TIMESTAMPDIFF(second,ctstamp,m.timestamp))...

Java Regular Expression Truncate Timestamp value

java,regex,datetime,timestamp,truncate
Input : 2007-02-09 00:00:00.0 Expected : 2007-02-09 How can we truncate 00:00:00.0 using Java Regular Expression ?...

Adding timestamp and custom name to a File uploaded via PHP

php,date,file-upload,timestamp,createfile
I was looking for a way to add a timestamp and a custom name to a file uploaded to my server via php. I does some readings on $_FILE[] to understand its arguments, but the official PHP docs give no detailed explanation. This is the code I use to upload,...

How do I combine a date and CSV filter to get the correct @timestamp field?

timestamp,logstash
I have a log file in txt format and I concluded after various hair-pulling attempts it was easiest and cleanest to use a csv filter ( I have experimented with grok patterns and it was messy). One line from my log file looks like this.... ( 5 fields with the...

Need a regex expression to validate timestamp with utc

java,regex,datetime,timestamp,utc
I have a date format like :- 2014-08-17T14:07:30+0521 or 2015-05-21T14:07:30+0521 Now I want to have a regex expression that can validate this date format.. I tried with the following format as given here How to check an UTC formatted date with a regular expression? :- \d{4}-[0-1]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-6]\d:\d{3}\+\d\d:\d\d but couldn't succeed .....

Postgres timestamp: what is the number after the dot and how to remove it?

postgresql,timestamp,sql-insert
I'm inserting new records to my Postgres database, using PHP. In my query i add the function now() to write the date and the time of the insert. $query = "INSERT INTO myTable(field1, field2, date, field4, field5) values('" . pg_escape_string($value1) . "', '" . (int) pg_escape_string($value2) . "', NOW(), '"...

Date parsing and timezone adjusting in pandas dataframes

python,datetime,pandas,timestamp
I have about 800,000 rows of data in a dataframe, and one column of the data df['Date'] is string of time and date 'YYYY-MM-DD HH:MM:SS.fff', which doesn't have timezone information. However I know they are in New_York timezone and they need to be convert into CET. Now I have two...

Parsing a timestamp with time zone [duplicate]

java,parsing,date,time,timestamp
This question already has an answer here: java.text.Parse Exception : Unparseable Date 2 answers I want to parse a timestamp given in this format timestamp="2015-05-21 12:38:00Z" using the class SimpleDateFormat. The problem is the "Z" in the end of timestamp which specifies the time zone. Unfortunately new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ")...

Convert epoch milliseconds to NSDate

ios,objective-c,timestamp,nsdate,epoch
I want to convert milliseconds elapsed since Jan 1 1970 to NSDate without loosing milliseconds. Every solution says to divide milliseconds by 1000 and use dateWithTimeIntervalSince1970. but I want to keep the preserve the to milliseconds as well.

String to date conversion with excess hours

sql,string,postgresql,casting,timestamp
Having the following example strings: '2015-01-01 23:51:00 AD' '2015-01-01 24:51:00 AD' '2015-01-01 26:51:00 AD' '2015-01-01 27:51:00 AD' Is there any way (by running a SQL query) to change the hour? If higher than 24 to do a hour - 24 So the resulting rows are: '2015-01-01 23:51:00 AD' '2015-01-01 00:51:00...

Redis - How to expire key daily

node.js,unix,redis,timestamp,sails.js
I know that EXPIREAT in Redis is used to specify when a key will expire. My problem though is that it takes an absolute UNIX timestamp. I'm finding a hard time thinking about what I should set as an argument if I want the key to expire at the end...

Java Timestamp to MySQL Timestamp

java,mysql,timestamp
I have this code, but it is not working. I have Error message: "com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '' for column 'Datum_zalozeni' at row 1" pstmt = conn.prepareStatement(INSERT); Timestamp ts = u.getDatum_zalozeni(); System.out.println(ts); pstmt.setTimestamp(1, ts); pstmt.setInt(2, u.getId_klient()); pstmt.executeUpdate(); My database is: CREATE TABLE Ucet ( Id_Uctu Int NOT NULL...

Better way to safely insert UTC time value into mySQL TIMESTAMP variable?

mysql,sql,datetime,timestamp,utc
My application wants to insert a timestamp value into a TIMESTAMP variable in a mySQL database. The timestamp value is a UTC time in the usual "YYYY-MM-DD HH:MM:SS" format. The problem is that my SQL server is set to use SYSTEM time (SELECT @@global.time_zone says SYSTEM), and the system timezone...

Processing data before saving to database Django Tastypie

django,timestamp,tastypie,data-type-conversion
I send a string to the server and I want to convert it to a Timestamp before saving in the database. I want to do this function before saving the data. date = time.strptime(date, "%Y-%m-%d %H:%M:%S") date is sent as a string and I want to convert it to a...

java.util.Date to java.sql.Date doesn't contain Time

java,sql-server,date,timestamp,sqlexception
I'm getting a SqlException on a PreparedStatement for violating a uniqueness constraint on a table (dupe key). Essentially my table looks like this: mytable ======= mytable_id PRIMARY KEY INT NOT NULL fizz_id INT NOT NULL buzz_timestamp DATETIME The uniqueness constraint is on the buzz_timestamp; that is, no 2 records may...

sqlite Select specific day of specific month and none specific month

sql,sqlite,date,timestamp
What I am trying to do is to select a specific month and a specific day from a timestamp. What I have tried is this: SELECT t FROM test WHERE t BETWEEN '2015-08-01 00:00:00' AND '2015-08-01 23:59:59'; with 8 being the specifc month and 1 being the specific day but...

R data frame timestamp manipulation [duplicate]

r,timestamp,data.frame
This question already has an answer here: Replacing NAs with latest non-NA value 4 answers I have the following data.frame > head(k) begin end type total_replies rpm 1 03/22/15 00:00:00 03/22/15 00:05:00 178.19 0.50 0.10 2 <NA> <NA> 178.19.6 0.50 0.10 3 03/22/15 00:05:00 03/22/15 00:10:00 178.1963 0.50 0.10...

Youtube embed display at one time start at beginning

wordpress,youtube,timestamp,embed
I am trying to embed a youtube video in my wordpress site and I would like to start it at the beginning but display it at another point for visuals, is this possible? I have looked online and in the youtube api with no luck..hoping Im missing it. Thanks for...

Groovy - timestamp from minutes

oracle,grails,groovy,timestamp
I have an array or times/values coming back to be in an array like: [0, 60] Which are times in minutes, 0 = 12:00 a.m, 60 = 1:00 a.m. I am wanting to store these in an oracle database as timestamps. How do I convert minutes into timestamps in groovy?...

Column in seconds.milliseconds to MIN:SS postgresql

postgresql,timestamp
I've a column with values in seconds.milliseconds and want to convert it to MI:SS. How do I do it?? I saw this question here which allowed me to convert when the values were only in seconds. Expected result: 235.00 = 3.55 I tried doing this: SELECT to_char(mycolumn ||'seconds.milliseconds')::interval 'MI.SS'); Doesn't...

How to pull the date in proper format from timestamp

oracle,timestamp
I am working in Oracle SQL Developer and have the following code SELECT Trunc(assigned_date, 'IW') AS bonus_week FROM (SELECT Trunc(blf.assigned_date) AS assigned_date FROM olap.bonus_lifecycle_fact blf) I get output in this form 07-12-03 08-01-28 08-01-28 08-01-28 08-01-07 Which is DD-MM-YY That's fine, except when I export to Excel I get some...

Doctrine2 default timestamp wtih “0000-00-00 00:00:00” format?

php,mysql,datetime,doctrine2,timestamp
I am using Doctrine2 ORM. I have an order table. Name | Type | Attributes | Null | Default -------------------------------------------------------------------------------- order_id | int | | No | None date_created | timestamp | | No | CURRENT_TIMESTAMP date_edited | timestamp | on update CURRENT_TIMESTAMP | No | CURRENT_TIMESTAMP date_sent | timestamp...

Updating timestamps in a document in [HH:MM:SS] format?

ruby,timestamp
I'm unfamiliar with Ruby, but I have a script that was written for me that I'm trying to modify. The script right now replaces timestamps in a document with an offset, with the timestamps in HH:MM format: #!/usr/bin/env ruby h, m, = 12, 07 $_.gsub!(/(\d\d):(\d\d)/) do '%02d:%02d' % (($1.to_i +...