unix-timestamp

What time corresponds to : time()-24*60*60 ? (PHP)

Hello, just a quick question, What time corresponds to : time()-24*60*60 ? (PHP) 7 days ? is that right ? Thanks ! ...

Trouble converting a stored unix time() stamp into a readable date time

So, $logarray[$row]["time"] is fetched from a MySQL table and placed into an array. The value is stored as a 10 digit int. When I try to pass it into the second parameter of date(), it tells me its expecting a long type, not a string type. So, I tried casting it into an int (couldn't find a long caster...). The error went away, but now i...

Convert UNIX timestamp to .NET DateTime ticks in unmanaged code (without using .NET)

I need to "construct" .NET DateTime values in Python/C++. How can I compute the number of ticks stored by DateTime starting from a UNIX timestamp? A solution involving Win32 API calls it's ok (I believe FILETIME functions could help). ...

Python datetime to Unix timestamp

I have to create an "Expires" value 5 minutes in the future, but I have to supply it in UNIX Timestamp format. I have this so far, but it seems like a hack. def expires(): '''return a UNIX style timestamp representing 5 minutes from now''' epoch = datetime.datetime(1970, 1, 1) seconds_in_a_day = 60 * 60 * 24 five_minute...

Converting UNIX timestamp into date, hours, minutes, second objective c

Hi all, How can you convert the UNIX timestamp (that is in the form of a number denoting timestamp) into date, time(hours, minutes, seconds) in Objective-C? Thanx in advance. ...

php strtotime() some help

Hi there, I am taking credit card details and I am taking the expiration date in two form field, one for the expiration month and one for the expiration year, I am wanting to store the expiration date as timestamp. Will strtotime("05/2010") create a time stamp or do I need to pass a day as well or is there an alternative? Thanks ...

How can I convert a file full of unix time strings to human readable dates?

I am processing a file full of unix time strings. I want to convert them all to human readable. The file looks like so: 1153335401 1153448586 1153476729 1153494310 1153603662 1153640211 Here is the script: #! /bin/bash FILE="test.txt" cat $FILE | while read line; do perl -e 'print scalar(gmtime($line)), "\n"' done This is not work...

Converting TIMESTAMP to unix time in PHP?

Currently I store the time in my database like so: 2010-05-17 19:13:37 However, I need to compare two times, and I feel it would be easier to do if it were a unix timestamp such as 1274119041. (These two times are different) So how could I convert the timestamp to unix timestamp? Is there a simple php function for it? ...

How to convert NSDate into unix timestamp iphone sdk

Hi all, How to convert an NSDate into Unix timestamp? I've read many posts which do the reverse. But I'm not finding anything related to my question. Thanx in advance. ...

jQuery timer, ajax, and "nice time"

So for this is what I've got: $(document).ready(function () { $("#div p").load("/update/temp.php"); function addOne() { var number = parseInt($("#div p").html()); return number + 1; } setInterval(function () { $("#div p").text(addOne()); }, 1000); setInterval(function () { $("#geupdate p").load("/update/temp.php");} ,10000); }); So th...

Which is quicker when indexed. INT (10) or Timestamp in MySQL

I was just wondering which field type would be the best solution for storing a timestamp in a MySQL database. Currently I store timestamps in an INT (10) field and insert the time by doing UNIX_TIMESTAMP(). If I was to use a timestamp field would it be slower or quicker when indexed? I know both fields use 4 bytes. ...

How can I convert an ISO8601 timestamp into unix time in Perl?

Given a string that represents a date/time in ISO8601 format (e.g. 20100723T073000), I need to ultimately parse this into a user-supplied format using a general strftime format string. In order to do that, I need to convert the ISO8601 timestamp to a Unix timestamp. There are a huge amount of date/time manipulation modules for Perl and I...

Problem with Function to convert UNIX TimeStamp

I get those two errors: - Can not use an object as parameter to a method - Incompatible types in return That's my code: - (NSString) dateStringFromUnixTimeStamp:(NSInteger)timeStamp { //Create Date-String from UNIX-Time-Stamp: NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeStamp]; NSDateComponents *monthComponents = [[NSC...

Find Unix Timestamp of Midnight on Most Previous Monday

How can I find the Unix Timestamp of midnight on (the beginning of) the most previous Monday? ...

Elegantly check if a given date is yesterday

Hi, Assuming you have a Unix timestamp, what would be an easy and/or elegant way to check if that timestamp was some time yesterday? I am mostly looking for solutions in Javascript, PHP or C#, but pseudo code and language agnostic solutions (if any) are welcome as well. ...

Using SQLite3 on iPhone to get midnight (this morning) as a UNIX timestamp

Okay, I really know this has GOT to be the long way around doing this... however, what I want is relatively simple one would think. I have a database with a timestamp column. I am using iPhone SDK with SQLite3. I want to have SQLite3 get all records for today (where timestamp >= midnight this morning) .. What i have come up with (th...

Convert from unixtime at command line

Is there a quick, one-line way to convert a unix timestamp to a date from the unix command line? I've searched through the other posts, and most seem to be a way to convert in the context of a particular language, or to convert datestrings into unixtime. I'm looking for a way to do the reverse at the command line. 'Date' might work, e...

PHP strtotime() function wrong by 1 hour?

I am converting dates and times into timestamps using PHP before they are inserted into my MySQL database. My problem is that when i use PHP's strtotime function the output timestamp is -1 hour behind my actual time. For example, considering todays date: 07/21/2010. When i use php code like: <?php $my_timestamp = strtotime("07/21/201...

Locating most recently updated file recursively in UNIX

For a website I'm working on I want to be able to automatically update the "This page was last modified:" section in the footer as I'm doing my nightly git commit. Essentially I plan on writing a shell script to run at midnight each night which will do all of my general server maintenance. Most of these tasks I already know how to automa...

When does a UNIX directory change its timestamp

I used "touch" on a file, updating the file's timestamp but the parent directory's timestamp did not change. However, (as expected) when I created a new file within the parent directory, the directory's timestamp did change. What criteria do UNIX-like operating systems (specifically AIX) use to determine when to update the timestamp of...