This topic is locked

About function of Date and time (newbie)

3/24/2008 3:58:47 AM
PHPRunner General questions
A
almonddgr8 author

Help guys,
On visual editor, on add page, (edit as settings, on default value) what syntax should I use to return a value of date and time in this format mmddyyttmmss, lets say today is March 24, 2008 at 1615 and 12 seconds military time, I should have 032408161512 this value.
My field type is varchar.

J
Jane 3/24/2008

Hi,
use PHP date() function.

Here is a sample:

date("mdyHis")


More info here:

http://php.net/manual/en/function.date.php

A
almonddgr8 author 3/25/2008

Hi,

use PHP date() function.

Here is a sample:
More info here:

http://php.net/manual/en/function.date.php


Thanks for the help jane, one more thing there's one more problem, the function you gave me keeps on returning wrong time not my desired time, and I think its because of the timezone, and I can't figure out what to do. My local timezone is set at +8 (Manila, Philippines), how can php code returns me my localtime. Let's say today is March 25,2008 and 2:00pm and 2 secs it returns the value 032508060002, instead of 032508140002.

J
Jane 3/25/2008

Hi,
try to use this one:

date("mdyHis",strtotime("+8 hours"))

R
ringlis1 4/15/2008

Hi,

try to use this one:


I tried this code to adjust for my local time, however, I always get the time part as 12:00:00am in the display although it does record the correct time.
Anyway to fix this so that it will display the adjusted date and time correctly on the add pages?

J
Jane 4/16/2008

Hi,
it's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.