Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
7218062b
Commit
7218062b
authored
Oct 31, 2005
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Le format d'affichage des dates se base sur $conf->format_date_text_short
parent
9fc29302
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/lib/functions.inc.php
+16
-9
16 additions, 9 deletions
htdocs/lib/functions.inc.php
with
16 additions
and
9 deletions
htdocs/lib/functions.inc.php
+
16
−
9
View file @
7218062b
...
...
@@ -419,23 +419,29 @@ function dolibarr_time_plus_duree($time,$duration_value,$duration_unit)
/**
\brief Formattage de la date en fonction de la langue $conf->langage
\param time Date 'timestamp' ou format 'YYYY-MM-DD' ou 'YYYY-MM-DD HH:MM:SS'
\param format Format d'affichage de la date "%d %b %Y"
\return string Date formate ou
"?"
si time nul
\param format Format d'affichage de la date
(
"%d %b %Y"
, "%d/%m/%Y", ...)
\return string Date formate ou
'?'
si time nul
l
*/
function
dolibarr_print_date
(
$time
,
$format
=
"%d %b %Y"
)
function
dolibarr_print_date
(
$time
,
$format
=
''
)
{
// Si date non dfini, on renvoie vide
if
(
!
$time
)
return
"?"
;
global
$conf
;
// Si format non dfini, on prend $conf->format_date_text_short
if
(
!
$format
)
$format
=
$conf
->
format_date_text_short
;
// Si date non dfinie, on renvoie '?'
if
(
!
$time
)
return
'?'
;
// Analyse de la date
if
(
eregi
(
'^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?'
,
$time
,
$reg
))
{
// Date au format 'YYYY-MM-DD' ou 'YYYY-MM-DD HH:MM:SS'
if
(
eregi
(
'^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?'
,
$time
,
$reg
))
{
// Date est au format 'YYYY-MM-DD' ou 'YYYY-MM-DD HH:MM:SS'
$syear
=
$reg
[
1
];
$smonth
=
$reg
[
2
];
$sday
=
$reg
[
3
];
$shour
=
$reg
[
4
];
$smin
=
$reg
[
5
];
if
(
$syear
<
1970
&&
$_SERVER
[
"WINDIR"
])
if
(
$syear
<
1970
&&
isset
(
$_SERVER
[
"WINDIR"
])
)
{
// Le formatage ne peut etre appliqu car windows ne supporte pas la fonction
// mktime si l'anne est infrieur 1970. On retourne un format fixe
...
...
@@ -446,7 +452,8 @@ function dolibarr_print_date($time,$format="%d %b %Y")
return
strftime
(
$format
,
mktime
(
$shour
,
$smin
,
0
,
$smonth
,
$sday
,
$syear
));
}
}
else
{
else
{
// Date est un timestamps
return
strftime
(
$format
,
$time
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment