jzhong5
(Jzhong5)
1
My app will launch in the US.
However, US do have several time zones.
I am using jquery’s time ago plugin but found a problem.
I save UTC time in my database (I guarantee it is UTC time not local time).
And jquery is using getTime() in its javascript which I believe should return UTC time, too.
However, it appears that getTime() is return the local time because it always gives me X hours ago even I just post the comment…
I really have no idea about what is going on…?
UTC(now)-UTC(post_time) should correct…? Why there is a time-zone problem?
sonnb
(Thuvanson)
3
This is PHP itself not Yii. You should use this.
<abbr class="DateTime" title="<?php echo date(DATE_ISO8601, $profile->profile_last_activity); ?>">
<?php echo date('M jS, Y', $profile->profile_last_activity); ?>
</abbr>
<script type="text/javascript">
jQuery(function($) {
$("abbr.DateTime").timeago();
});
</script>
jzhong5
(Jzhong5)
4
Thanks man!! Works like a charm!