/[cvs]/nfo/php/libs/net.php.smarty/plugins/shared.make_timestamp.php
ViewVC logotype

Annotation of /nfo/php/libs/net.php.smarty/plugins/shared.make_timestamp.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Wed Oct 9 00:53:36 2002 UTC (21 years, 10 months ago) by cvsjoko
Branch: MAIN
no message

1 cvsjoko 1.1 <?php
2    
3     /*======================================================================*\
4     Function: smarty_make_timestamp
5     Purpose: used by other smarty functions to make a timestamp
6     from a string.
7     \*======================================================================*/
8     function smarty_make_timestamp($string)
9     {
10     if(empty($string)) {
11     $string = "now";
12     }
13     $time = strtotime($string);
14     if (is_numeric($time) && $time != -1)
15     return $time;
16    
17     // is mysql timestamp format of YYYYMMDDHHMMSS?
18     if (is_numeric($string) && strlen($string) == 14) {
19     $time = mktime(substr($string,8,2),substr($string,10,2),substr($string,12,2),
20     substr($string,4,2),substr($string,6,2),substr($string,0,4));
21    
22     return $time;
23     }
24    
25     // couldn't recognize it, try to return a time
26     $time = (int) $string;
27     if ($time > 0)
28     return $time;
29     else
30     return time();
31     }
32    
33     /* vim: set expandtab: */
34    
35     ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed