Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

date and time

Posted on 2000-03-14
3
Medium Priority
?
214 Views
Last Modified: 2010-03-05
can someone pls show mi a way to get the date(day month year) and time(hour min) ?
0
Comment
Question by:prinx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
alien_life_form earned 400 total points
ID: 2615973
Greetings.

#print it
print scalar(localtime());

#assign to a variable:

$now=scalar(localtime());

#get the components separately:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
                                            localtime(time);

$year += 190;  #Y2k

#seconds from epoch (1/1/1970)
$snow=time();

In the array form, month is a number in the range 0-11, wday in the range 0-6.

Cheers,
    alf

0
 

Author Comment

by:prinx
ID: 2616399
so...we onli need :
#!/usr/local/bin/perl
use CGI;
$q = new CGI;
print scalar(localtime());
$now=scalar(localtime());
print $q->header();
print "$now"; #print the time
exit;

rite ?
0
 
LVL 3

Expert Comment

by:alien_life_form
ID: 2617282
Right.

Actually, you only need the second print.
The first one will actually make your script bomb (you're printing to stdout before outputting the header, and tha's a no-no).


Cheers,
      alf
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question