Tuesday, 9 June 2020

time stamp how to display date and time

time stamp how to display date and time
<?php
echo time();
it wil give how many seconds till now and it is not user frndly
$time =time();
store the time into a variable
$realtime = date(' H:i:s', $time);
date is a function , it has argument is one is string another is variable
echo ' the current time is : '.$realtime;
string format - H.i.s it is 24 hours time , h.i.s - it is 12 hours time
?>
H:i:s
3:34:56
D M Y
day: month :year- mon may :2020
d m Y
25 06 2020
D d m y
mon 25 jun 2020
D d m y @ h:I:s
mon 25 jun 2020 @ 3:38:56
if the shown time is wrong , some caliculation is there
go to xampp, php , phpin configuration setting file
date.timezone=Europe/Berlin
search for time zone, change to UTM
how to convert to required format
$time =time();
till now how amny seconds ,strored to time variable
$realtime = date(' H:i:s', $time);
time variable convert to hours and seconds using date
$changedtime = strtotime ('+ 5 hours 30 miutes');
it will convert to reqired time utc +5:30
$ctime = date('D d M Y @ h:i:s', $changedTime;
changed time converted to required format using date
echo 'the date/time is :'. $realtime. '<br><br>';
print the time beflore conversion
echo 'the current date or time is : '. $ctime;
print the date after conversion as like ur pc
applications : membership expiry, expire the exam
echo '<h2>the current date or time is : '. $ctime. '<h2/>;
$mtime = strtotime(' + 1 week 5 hours 30 minutes');
it will add this time to utc
echo '<h2>the current date or time is : '. $mtime. '<h2/>;
print in seconds
$htime = date('D d M Y @ h:i:s', $mtime;
convert to defined formant
echo '<h2>the current date or time is : '. $htime. '<h2/>;
print that

time()
date()
H:i:s
D M Y
d m Y
D d m y
D d m y @ h:I:s
time()
date(' H:i:s', $time);
strtotime(value add)
date()
echo
concatenation
strtotime
date
how to print the date and time
is it print in seconds uisng time
how to print the date into required format
how to print in 12 hours formant
how to print in 24 hours formant
whats the procedure to change to utc from europe
how to convert utc to required time
how to know wahts the date after 10 days
how to print to required format



No comments:

Post a Comment