how to store my date in variables using locatime
Question posted by: poolboi
(Familiar Sight)
on
May 13th, 2008 03:30 AM
hey guys,
Code: ( text )
($sec, $min, $hrs, $day, $month, $year) = (localtime) [0,1,2,3,4,5]; printf("%04d-%02d-%02d\n", $year+1900, $month+1, $day);
the above right print the date say today:
2008-05-13
how do i store the in a variable say $date
cos i want to use it later in the later part of my script
thanks
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
|
|
May 13th, 2008 04:50 AM
# 2
|
Re: how to store my date in variables using locatime
Code: ( text )
($sec, $min, $hrs, $day, $month, $year) = (localtime) [0,1,2,3,4,5]; $date = sprintf("%04d-%02d-%02d\n", $year+1900, $month+1, $day); print "$date";
The sprintf() function is used to format string/variables and return the formatted string to a variable.
|
|
May 13th, 2008 06:06 AM
# 3
|
Re: how to store my date in variables using locatime
thanks a lot nithinpes..u helped me a lot
Not the answer you were looking for? Post your question . . .
170,099 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).
|
|
|
Top Perl Forum Contributors
|