473,390 Members | 1,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

MMYYYY - datestamp

How would I find the month and year from something with a datestamp of
1078801582? (The day does not matter)
Jul 19 '05 #1
5 6076
Zee Zop wrote:
How would I find the month and year from something with a datestamp
of 1078801582? (The day does not matter)


perldoc -f localtime
perldoc -f gmtime

Next time, post to comp.lang.perl.misc instead. This group is defunct.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Jul 19 '05 #2
Zee Zop wrote:
How would I find the month and year from something with a datestamp of
1078801582? (The day does not matter)


Is this from the Romulan or the Klingon calendar?

jue
Jul 19 '05 #3
Zee Zop wrote:
How would I find the month and year from something with a datestamp of
1078801582?


You want localtime() in list context. Be mindfull of $month+1 and $year+1900.

Using localtime() in scalar context is also handy:
perl -le 'print scalar localtime 1078801582'

-Joe
Jul 19 '05 #4
$MYTIMESTAMP = "1095967319";

($ss,$mi,$hh,$dd,$mm,$yy ,$wday,$ddd ,$isdst) = localtime($MYTIMESTAMP);
$yy+=1900;
$mm+=1;
$mm = substr("0".$mm,-2,2);
$dd = substr("0".$dd,-2,2);
$hh = substr("0".$hh,-2,2);
$mi = substr("0".$mi,-2,2);
$ss = substr("0".$ss,-2,2);
print "$yy-$mm-$dd $hh:$mi:$ss";
"Zee Zop" <ze****@gmail.com> wrote in message
news:x1*******************@news20.bellglobal.com.. .
How would I find the month and year from something with a datestamp of
1078801582? (The day does not matter)

Jul 19 '05 #5
Dan van Ginhoven wrote:
$MYTIMESTAMP = "1095967319";

($ss,$mi,$hh,$dd,$mm,$yy ,$wday,$ddd ,$isdst) = localtime($MYTIMESTAMP);
$yy+=1900;
$mm+=1;
$mm = substr("0".$mm,-2,2);
$dd = substr("0".$dd,-2,2);
$hh = substr("0".$hh,-2,2);
$mi = substr("0".$mi,-2,2);
$ss = substr("0".$ss,-2,2);
print "$yy-$mm-$dd $hh:$mi:$ss";


What kind of grudge do you have against the sprintf() function? ;-)

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bert Sierra | last post by:
Hello -- I have what appears to be a simple PHP+MySQL query, but Dreamweaver consistently generates PHP code which won't parse. I've stared at the PHP code for several hours now, and I can't...
0
by: Avery Tarasov | last post by:
im totally stumped on how to get information about names and datestamps of previously deleted files.. i want to write a program that deletes this information--i am not worried about recovering the...
0
by: Jeff York | last post by:
Hi- Pretty new to VB, but i am trying to rename a file that has a date stamp. The datestap changes each day so I need a away overcome I tried to use a wild card, but no luck. Here is the...
8
by: Daniele Baroncelli | last post by:
How can I get the original datestamp of uploaded files? The array $_FILES doesn't seem to contain the original date. Any solution? Daniele
1
by: drec | last post by:
I have setup a script which will query a mysql db and then give the option to export this file to a filename that I have setup. As of now I am just calling it export.csv, but I would like to be...
4
by: BrighterLater | last post by:
To help users identify what version of my program they are using, I want it to have an "Identity string" available. eg "Prog: Bodgit, Version: 0.0.0, Compiled: 20061215" The version number...
17
by: Phil M | last post by:
Hi all. I have am HTML web page where I upload an updated file which is always called document.pdf. Users get there, click on the icon and download the document.pdf. Below the icon/link where...
1
by: jpgoeth1 | last post by:
Hi, I'm brand-new to access 2007 and I need a little help building my first database. I'm importing from a text file and I'd like to add a datestamp as a separate column. This would hold the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.