timestamp

Renaming the created_at, updated_at columns of ActiveRecord/Rails

I want to rename the timestamp columns defined in timestamp.rb . Can the methods of timestamp.rb be overwritten? And what has to be done in the application that the module with the overwritten methods is used. ...

best way to keep track of an ordered smalldatetime column

I know the difference between smallDateTime and timeStamp. Right now I am using smallDateTime because the precision is good enough for my needs. But the problem is that I still need to keep inserted items in order and smallDateTime is mixing things up if the inserts come too close to each other. Is it an acceptable practice to use both ...

Keep timestamp when copying my SQL Server database

I'm copying an SQL Server 2005 database from one server to another, with the Database>Tasks>Copy Database wizard, and it works great, except for the timestamp column whose values are not copied. Is there a way to have the timestamp values be preserved on database copy? ...

Best timestamp format for CSV/Excel?

I'm writing a CSV file. I need to write timestamps that are accurate at least to the second, and preferably to the millisecond. What's the best format for timestamps in a CSV file such that they can be parsed accurately and unambiguously by Excel with minimal user intervention? ...

Unable to read the timestamp of Zsh history

Problem: to understand the following timestamp 1241036430 at ~/.history : 1241036336:0;vim ~/.zshrc : 1241036379:0;vim ~/bin/HideTopBar : 1241036421:0;ls : 1241036430:0;cat ~/.history when I have setopt EXTENDED_HISTORY HISTFILE=~/.history in .zshrc. How can you read the timestamp? ...

Setting a JPA timestamp column to be generated by the database?

In my SQL Server 2000 database, I have a timestamp (in function not in data type) column of type datetime named lastTouched set to (getdate()) as its default value/binding. I am using the Netbeans 6.5 generated JPA entity classes, and have this in my code @Basic(optional = false) @Column(name = "LastTouched") @Temporal(TemporalType.TIM...

mysql timestamp only on create

I use timestamp on mysql 5.x (with PHP) to remember event times. During development I had to update the table with a query that changes something in all columns. The timestamp was then reset to current time. How can I make timestamp change only on inserts and not on updates or replace ? ...

MySQL Timestamp - why all zeros?

I'm using PHPMyAdmin and I've got a MySQL table column called "timestamp." The type (surprise!) is TIMESTAMP, and in 'attributes' I've set it to ON UPDATE CURRENT_TIMESTAMP. However, each new record gets a timestamp that looks like this: 0000-00-00 00:00:00 I have explicitly set the default value to none, but when I save and come bac...

SQL Server - what is the date/time of the last inserted row of a table ?

My fellow programmers did not think to add timestamps to every tables of our outanding database... Result : some tables seems to be outdated, but it is very difficult to say. What I would really like is to get, for each table, the date/time of the last insert command performed against it. Is it any way to tell it ? Thanks in advance ...

Adding sum of current_timestamp and days column in Postgres

I want update a column by adding days to current time. In pseudosyntax it would be: UPDATE foo SET time = current_timestamp + days::integer days is a column in the same table. ...

Converting a java System.currentTimeMillis() to date in python

Hello, I have timestamp in milliseconds from 1970. I would like to convert it to a human readable date in python. I don't might losing some precision if it comes to that. How should I do that ? The following give ValueError: timestamp out of range for platform time_t on Linux 32bit #!/usr/bin/env python from datetime import date prin...

How can I convert a log4j timestamp to milliseconds in Perl?

The log4j logs I have contain timestamps in the following format: 2009-05-10 00:48:41,905 I need to convert it in perl to millseconds since epoch, which in this case would be 124189673005, using the following gawk function. How do I do it in perl? I have little or no experience in perl, so appreciate if someone can post an entire sc...

How to perform arithmetic operation on Oracle timestamps (in SQL)?

I need to select an entity that is valid at the midth of the validity of different entity. As a simplified example, I want to do something like this: select * from o1, o2 where o1.from < (o2.to - ((o2.to - o2.from) /2) ) and o1.to > (o2.to - ((o2.to - o2.from) /2) ) How can I compute "(o2.to - ((o2.to - o2.from)...

Add Timestamp to Trace.WriteLine()

In my C# .NET application I have an issue with the Trace.WriteLine()-method. I uses this method alot, and want to add a TimeStamp every time I use it. Instead of Trace.WriteLine(DateTime.Now + " Something wrong!"), is there a solution where the DateTime is on default? ...

Database agnostic SQL for returning list for Date of birth stored as a Timestamp

If I need to search on Date of birth which is stored without the hours and minutes but the date I have to search with includes hours and minutes what is the best way to return all rows where date is matched on only day, month and year i.e. Stored as 01-JAN-50 10.22.06.000000000 date selected 01-JAN-50 10.22.06.010101120 If I us...

How to check if a date has passed

I am trying to check if a date has passed or if it is the future. If the end_date has passed then I do not want it to display. end_date is a MySQL timestamp. Right now all news articles are displaying even if their end_date has passed. Here is the code I am using to check if the date has passed: function dateExp( $timestamp ){ $exp ...

Function that creates a timestamp in c#

Hi there, I was wondering, is there a way to create a timestamp in c# from a datetime? I need a millisecond precision value that also works in Compact Framework(saying that since DateTime.ToBinary() does not exist in CF). My problem is that i want to store this value in a database agnostic way so i can sortby it later and find out whic...

How to implement automatic timestamps for record changes (SQL Server)

I am used to using "changed_at" fields in my MySQL database that Ruby on Rails automatically updates when changing a record. Now I am using ASP.NET MVC with SQL Server 2008 and I am wondering, how would I proceed to get the same functionality. Does SQL Server have an option for auto updating a field when updating? ...

How to calculate the smallest period of time between consecutive events?

Lets say that I have a table with a timestamp column full of records and I want to calculate the smallest time difference between two consecutive records using only one query. Maybe a table like... CREATE TABLE `temperatures` ( `temperature` double, `time` timestamp DEFAULT CURRENT_TIMESTAMP ); ...

Change timestamp of SVN revision

Hi, the situation is likely the one described in another thread (I am not allowed to add a hyperlink, because I am a new user) Of course, I have also already tried the solution suggested in that thread (i.e. changing the svn:date property in my case from 2003-01-01 to 2009-05-16), and checked that it really has changed. (What I've done f...