Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im wondering how can I formulate a function which receives input in the string format "day.month.year hours: minutes: seconds" (for example, "10.12.2012 3:25:05") and returns the time in the form of {year, month, day, hour, min, sec}.

I guess a start is

 datelist[{"10.12.2012 03:25:05", {"Day", "Month", "Year", "Hour", "Minute", "Second"}}]

but how do I continue?

share|improve this question
Like this DateList[{"10.12.2012 03:25:05", {"Day", ".", "Month", ".", "Year", " ", "Hour", ":", "Minute", ":", "Second"}}] ? – b.gatessucks Dec 10 '12 at 14:09

I'm not sure I understand your problem. Apart from the incorrect capitalization of the function name your suggested input

DateList[{"10.12.2012 03:25:05", {"Day", "Month", "Year", "Hour", "Minute", "Second"}}]

{2012, 12, 10, 3, 25, 5.}

seems to do exactly what you want.

Rolling that into a function is rather trivial:

dateConvert[date_String] := 
        DateList[{date, {"Day", "Month", "Year", "Hour", "Minute",   "Second"}}]
share|improve this answer
Thanks for your help and time users: b.gatessucks and Sjoerd C. de Vries. Problem is solved. Thanks – Raymond... Dec 10 '12 at 23:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.