473,320 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Timestamps for 1800's

I'm trying to convert this date:
12 May1868
Into this:
18690512
That's YYYYMMDD. So first I need to convert it to a UNIX time stamp
using the strtotime() function, then convert it to YYYYMMDD. This
works for more rescent dates:
$d = date('Ymd', strtotime($d));
I tested that with 19 July2005, and it worked. But the strtotime()
function seems to return -1 for dates before the UNIX epoch. How can I
convert these dates?

Jul 21 '05 #1
5 2021
have the monthnames in an array.
split on spaces
loop array until you find the right month
add 1 (or have array[0]='none'; )
put string together in your format
done

"DJ Craig" <sp**@djtricities.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I'm trying to convert this date:
12 May1868
Into this:
18690512
That's YYYYMMDD. So first I need to convert it to a UNIX time stamp
using the strtotime() function, then convert it to YYYYMMDD. This
works for more rescent dates:
$d = date('Ymd', strtotime($d));
I tested that with 19 July2005, and it worked. But the strtotime()
function seems to return -1 for dates before the UNIX epoch. How can I
convert these dates?

Jul 21 '05 #2
don't double post. crosspost please

Mich

"DJ Craig" <sp**@djtricities.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I'm trying to convert this date:
12 May1868
Into this:
18690512
That's YYYYMMDD. So first I need to convert it to a UNIX time stamp
using the strtotime() function, then convert it to YYYYMMDD. This
works for more rescent dates:
$d = date('Ymd', strtotime($d));
I tested that with 19 July2005, and it worked. But the strtotime()
function seems to return -1 for dates before the UNIX epoch. How can I
convert these dates?

Jul 21 '05 #3
Thanks for the help. How do you crosspost with Google Groups?

Jul 21 '05 #4
DJ Craig spilled the following:
I'm trying to convert this date:
12 May1868
Into this:
18690512
That's YYYYMMDD. So first I need to convert it to a UNIX time stamp
using the strtotime() function, then convert it to YYYYMMDD. This
works for more rescent dates:
$d = date('Ymd', strtotime($d));
I tested that with 19 July2005, and it worked. But the strtotime()
function seems to return -1 for dates before the UNIX epoch. How can I
convert these dates?


32bit Unix time only works from 1970 to 2036 (ish)

C.
Jul 21 '05 #5
Michel <no@spam.please> wrote:
don't double post. crosspost please

Mich

"DJ Craig" <sp**@djtricities.com> wrote in message

[snip 15 lines]

And in other good advice to be found elsewhere: don't TOFU
instead keep it readable please.
Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: lkrubner | last post by:
This might be an idiot question, but how do you group by timestamps by date? I mean, given a large number of timestamps, spanning many months, how do grab them and say how many are from each day?...
10
by: Craig Wahlmeier | last post by:
Am I the only one in the world that selects dates and timestamps with OLEDB? V8 of UDB has brought me a big problem. The PATCH2=24 setting no longer works the way it used to. The settings of...
5
by: Robert Schuldenfrei | last post by:
Dear NG, I have not heard from anyone about a good book that deals with the concurrency issue in SQL Server using C#. I have PROMISED Nick I would not use record locking and I have used an old...
2
by: Chumma Dede | last post by:
Hi, I need to code a DLL in .NET which logs the response times for our asp.net multi-tier application. The problem is we need to log the timestamps at multiple stages in a process lifecycle...
4
by: Craig G | last post by:
im not too sure how i should be storing the SQL2000 timestamps basically i return a dataset which is used to populate an editable grid. this dataset contains the timestamp. how should i be...
1
by: Erwin Van de Velde | last post by:
Hi, I'm building a central logging system for security applications as my master thesis, but I've run into some troubles: Different applications make database logs using different formats: -...
3
by: rAinDeEr | last post by:
Hi, Is there any performance issues related to having default timestamps in tables? I have a Data Model in which all the tables have created_tms and last_updated_tms which I have set default...
0
by: mikek | last post by:
Good Morning from Detroit, I am working on a project to Connect and manipulatee data in a SQLServer Data base, from a LINUX server using PERL. and SOAP We decided to use SOAP:Lite. (there are...
16
by: maruk2 | last post by:
I have some old data files with old timestamps, where timestmap=time(NULL), some of them date back to the year 1999. I want to my code to print the timestamps and each one to include...
6
by: xkenneth | last post by:
All, Just a quick question. I want to be able to have a data structure that organizes data (timestamps I'm working with) sequentially, so that i can easily retrieve the first x amount of...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.