473,407 Members | 2,320 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,407 software developers and data experts.

Insert file date created into a variable

Is there a better/simpler way than this?

use POSIX ('strftime');
my $dateCreated = strftime "%b %d, %Y %H:%M", localtime
((stat("c:\\test.txt"))[10]);

How would I go about displaying the output in this format: 20031105
14:00? Any advice of links would be appreciated. Thanks in advance
-Chris
Jul 19 '05 #1
1 7832
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

pe*********@hotmail.com (Chris Petersen) wrote in
news:d1**************************@posting.google.c om:
Is there a better/simpler way than this?

use POSIX ('strftime');
my $dateCreated = strftime "%b %d, %Y %H:%M", localtime
((stat("c:\\test.txt"))[10]);

How would I go about displaying the output in this format: 20031105
14:00? Any advice of links would be appreciated. Thanks in advance
-Chris


This is why I wrote Time::Format. I got sick of looking up the awkward
strftime %-codes, and was tired of having to make do when they weren't
flexible enough.

use Time::Format;
my $dateCreated = time_format('yyyymmdd hh:mm',(stat $file)[10]);

http://search.cpan.org/~roode/Time-F...0.13/Format.pm

Hope it helps.
- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP6mISWPeouIeTNHoEQLZQwCgnh5zmXI0rLBQYUzcMWpEU/T4dO0An28m
Qv8YB1yVKzx0ofBrlLrcFPfw
=0SEz
-----END PGP SIGNATURE-----
Jul 19 '05 #2

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

Similar topics

10
by: Chris | last post by:
Hi, Not sure if this is the right forum, but hopefully someone can help me. I am creating something for our intranet and i want to list the files and folders of a directory, i found some code...
18
by: Robin Lawrie | last post by:
Hi again, another problem! I've moved from an Access database to SQL server and am now having trouble inserting dates and times into seperate fields. I'm using ASP and the code below to get the...
24
by: pristo | last post by:
hello All, how can i insert unique ID into binary file (that created by compiler)? (so after compiling i can to identify the src that i use) thx
1
by: =?Utf-8?B?TW9uaWNh?= | last post by:
hi SQL queries does not recognize *$()!.,?/\{};:'"&^+=<>|. if I have a variable alike this: Date = "Thursday, March 01, 2007 - 9:53 PM"; how can I inset in my database? strCommand =...
2
by: Killer42 | last post by:
The Input #1 statement simply reads in one line from a text file (in this case you INI file) and places the values from it into one or more variables. So what you are reading in this statement is...
0
chumlyumly
by: chumlyumly | last post by:
Hello scripters - OS: Mac OSX Language: PHP w/ MySQL database I've created an insert page where a user inputs his info, which then goes to four different tables in a MySQL database. The...
4
chumlyumly
by: chumlyumly | last post by:
Hi - I'm working with PHP5 MySQL Mac OSX I've developed two pages where a user can input his/her info, which goes to a MySQL database. The first page is supposed to pass the newly created...
2
by: logo3 | last post by:
hello, I'm trying to fill the table named "ALBARANES" which is based on a query. The query use table "structureOK". There are 3 additional values should be updated. AS Expr2 AS Expr3 AS...
3
Minion
by: Minion | last post by:
I hate to even post this message as I probably know the answer before I begin. Still there are several problems facing me with this particular challenge. First though I'll goto into the overview...
5
by: maestroQC | last post by:
Hi, Its one of those days. I cannot solve this. Any help would be greatly appreciated! When I execute this: class Db(object): def insertAccount(self, date, accountNumber, description,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.