CookieMonster9999
asked on
date formats
Hello
I am trying to standardize how dates are stored on my site.
In one place they appear as:
3/13/2004
3/14/2004
3/21/2004
etc...
and another they appear as:
1079551798
1079334828
1079368763
how do I convert the 1st few dates into the 2nd format.
Thanks
I am trying to standardize how dates are stored on my site.
In one place they appear as:
3/13/2004
3/14/2004
3/21/2004
etc...
and another they appear as:
1079551798
1079334828
1079368763
how do I convert the 1st few dates into the 2nd format.
Thanks
Hi CookieMonster9999,
I guess that the 2nd format is a serial date format.
The following code converts standard date to serial date:
<% DateSerial = Date - CDate("January 1, 1900") + 1 %>
RedLava
I guess that the 2nd format is a serial date format.
The following code converts standard date to serial date:
<% DateSerial = Date - CDate("January 1, 1900") + 1 %>
RedLava
ASKER
hm... that doesn't seem to be it.
php is inserting time() into the database...
does time include both date and time in php?
php is inserting time() into the database...
does time include both date and time in php?
PHP??
If the database is just storing time then how are you displaying the dates?
now() will store both date and time where as date stores just the date.
The code to use to solve your problem doesn't interface with the database it acts on the date variable.
Place your date from the first output in the 'date' area of the code.
e.g.
<% NewOutput = OldOutput - CDate("January 1, 1900") + 1 %>
RedLava
If the database is just storing time then how are you displaying the dates?
now() will store both date and time where as date stores just the date.
The code to use to solve your problem doesn't interface with the database it acts on the date variable.
Place your date from the first output in the 'date' area of the code.
e.g.
<% NewOutput = OldOutput - CDate("January 1, 1900") + 1 %>
RedLava
ASKER
I tried the code that you posted but it results in entries like this:
38033
38040
38040
38054
38054
which don't seem to match php entries which look like this:
1079551798
1079334828
1079368763
the php entries are coming from the phpbb script which reads:
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password)
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "')
38033
38040
38040
38054
38054
which don't seem to match php entries which look like this:
1079551798
1079334828
1079368763
the php entries are coming from the phpbb script which reads:
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password)
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "')
ASKER
I have since discovered that phpbb is using the UNIX timestamp which measures the number of seconds since 1st January 1970.
Is this a PHP or ASP question?
ASKER
I'm trying to convert a date and time like 3/22/2004 11:24:00 PM into the phptimestamp format for time which is counting the number of seconds from Jan 1st 1970 until that moment.
I am coding this in ASP
I am coding this in ASP
ASKER
ASKER
For anyboyd else that is interested- to get the UNIX timestamp of a current date and time in VBscript:
DateDiff("s", "01/01/1970 00:00:00", now())
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
1 03/22/2004 500 date formats Open Active Server Pages (ASP)
2 03/21/2004 500 music files with different bit rates Open Web Development
3 03/18/2004 250 uppercase vs. lowercase Open Active Server Pages (ASP)
4 03/15/2004 500 batch mp3 preview making Open Web Development
8 02/13/2004 500 Locked out of files Open Windows XP
Please let me know if you need assistance.