Join us in building a kind, collaborative learning community via our updatedCode of Conduct.

Questions tagged [timestamp]

A timestamp is the time at which an event is recorded by a computer system. The timestamp term may also refer to Unix Time or to the timestamp data type.

3375
votes
36answers
2.3m views

How do you get a timestamp in JavaScript?

How can I get a timestamp in JavaScript?Something similar to Unix's timestamp, that is, a single number that represents the current time and date. Either as a number or a string.
2307
votes
35answers
709k views

Should I use the datetime or timestamp data type in MySQL?

Would you recommend using a datetime or a timestamp field, and why (using MySQL)? I'm working with PHP on the server side.
574
votes
17answers
207k views

How can one change the timestamp of an old commit in Git?

The answers to How to modify existing, unpushed commits? describe a way to amend previous commit messages that haven't yet been pushed upstream. The new messages inherit the timestamps of the ...
392
votes
14answers
1.2m views

NOW() function in PHP

Is there a PHP function that returns the date & time in the same format as the MySQL function NOW()? I know how to do it using date(), but I am asking if there is a function only for this. For ...
369
votes
2answers
94k views

In Ruby on Rails, what's the difference between DateTime, Timestamp, Time and Date?

In my experience, getting dates/times right when programming is always fraught with danger and difficulity. Ruby and Rails have always eluded me on this one, if only due to the overwhelming number ...
311
votes
6answers
177k views

How to convert a unix timestamp (seconds since epoch) to Ruby DateTime?

How do you convert a Unix timestamp (seconds since epoch) to Ruby DateTime?
297
votes
19answers
737k views

How to convert date to timestamp in PHP?

How do I get timestamp from e.g. 22-09-2008?
248
votes
8answers
389k views

Create timestamp variable in bash script

I am trying to create a timestamp variable in a shell script to make the logging a little easier. I want to create the variable at the beginning of the script and have it print out the current time ...
242
votes
9answers
278k views

How to get the unix timestamp in C#

I have had look around stackoverflow, and even looked at some of the suggested questions and none seem to answer, how do you get a unix timestamp in C#?
202
votes
8answers
218k views

Java: Date from unix timestamp

I need to convert a unix timestamp to a date object.I tried this:java.util.Date time=new java.util.Date(timeStamp);Timestamp value is: 1280512800The Date should be "2010/07/30 - 22:30:00" (as ...
202
votes
13answers
203k views

Creation timestamp and last update timestamp with Hibernate and MySQL

For a certain Hibernate entity we have a requirement to store its creation time and the last time it was updated. How would you design this?What data types would you use in the database (assuming ...
186
votes
29answers
187k views

Converting timestamp to time ago in PHP e.g 1 day ago, 2 days ago…

I am trying to convert a timestamp of the format 2009-09-12 20:57:19 and turn it into something like 3 minutes ago with PHP.I found a useful script to do this, but I think it's looking for a ...
179
votes
5answers
141k views

Ruby/Rails: converting a Date to a UNIX timestamp

How would I get a UNIX timestamp (number of seconds since 1970 GMT) from a Date object in a Rails app?I know Time#to_i returns a timestamp, but doing Date#to_time and then getting the timestamp ...
179
votes
9answers
218k views

Android Get Current timestamp?

I want to get the current timestamp like that : 1320917972int time=(int) (System.currentTimeMillis());Timestamp tsTemp=new Timestamp(time);String ts=tsTemp.toString();
166
votes
9answers
130k views

Why there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT clause?

Why there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause?CREATE TABLE `foo` (`ProductID` INT(10) UNSIGNED NOT NULL,`AddedDate` TIMESTAMP NOT NULL ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,