Solved

Today's date and time in seconds

Posted on 2007-04-01
3
252 Views
Last Modified: 2013-12-12
Experts,

I need to create today's date and time in seconds for a unique invoice reference.
0
Comment
Question by:mhouldridge
[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
3 Comments
 
LVL 2

Expert Comment

by:wakemup
ID: 18831609
PHP's time() wil give you a unix timestamp which is seconds since 1st January 1970.

You'll only have a 1 second resolution though so if you're getting more than one request per second you'll need to use microtime() or some such depending upon your platform.
0
 
LVL 20

Expert Comment

by:steelseth12
ID: 18831613
0
 
LVL 14

Accepted Solution

by:
raja_ind82 earned 500 total points
ID: 18840136
<?php
$today  = mktime(date("g"), date("i"), date("s"), date("m")  , date("d"), date("Y"));
$tomorrow  = mktime(0, 0, 0, date("m"), date("d")+1,   date("Y"));
$lastmonth = mktime(0, 0, 0, date("m")-1, date("d"),   date("Y"));
$nextyear  = mktime(0, 0, 0, date("m"),   date("d"),   date("Y")+1);

echo $today." -Today <br>";
echo $tomorrow." -Tommorrow <br>";
echo $lastmonth." -Last Month<br>";
echo $nextyear." -Next Year<br>";
?>

Regards,
M.Raja
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

749 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