0

I'm here for a conversion issue.

I have a perl program that gets the uptime of a router, and the output is like :

 "0000/8/17 1:50:0"

where : - 0000 --> Year of uptime - 8 --> Month of uptime - 17 --> Days of uptime and so on... (hh:mm:ss)

I made this to match the Mysql TIMESTAMP format. But actually, Mysql don't want year under 1967 and over 2037 (don't know why) When i'm adding this to my database, the result is 0000-00-00 00:00:00 because of the year

Isn't there anything that we can to get a year under 1967 with mysql ? (year 0, year 1...)

Gui O
  • 363
  • 4
  • 8
  • 22
  • This should probably be three separate columns instead of a munged up date. – John Conde Jan 02 '14 at 14:36
  • Well, i would love to get it as a single column, because i'll use it later on a inner website... – Gui O Jan 02 '14 at 14:38
  • How about converting to "total number of seconds" and storing as a single 32-bit or 64-bit int? – cbranch Jan 02 '14 at 14:39
  • That will force me to treat data after inserting them inside the database. To put em back as representative duration for a client that can see these data for example. Timestamp is a good idea, to check for example if a lot of routers restart frequently, a simple sql request can be made... But this restriction is...embarassing – Gui O Jan 02 '14 at 14:42

1 Answers1

0

Datetime can accept date under 1970. I just have to convert timestamp as datetime. I guess there's nothing much difference but this.

Gui O
  • 363
  • 4
  • 8
  • 22