View Full Version : help with date and time stored as int
mulaus
04-06-2012, 01:15 AM
Hi,
im a php/mysql newbie..
i have a date and time stored as int in sql
example like this
1333239000
how do i display this in my php page
to be something like
25/6/2012 7.28am
mulaus
04-06-2012, 01:42 AM
got it
".date('Y-m-d', $datesub)."
more specifically, to follow your posted format:
<?php
$datesub = 1340634480;
// unix timestamp
$format = 'j/n/Y g.ia';
// j = day of month (no leading zero - use "d" if you want a leading zero)
// n = month of year (no leading zero)
// Y = full year
// g = hour of day (12-hour format, no leading zero)
// i = minute of hour
// a = lowercase am/pm
print date( $format,$datesub );
// prints "25/6/2012 7.28am"
mulaus
04-06-2012, 02:52 PM
Tq Traq
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.