ayok Posted January 7, 2009 Share Posted January 7, 2009 Hi guys, First, Happy New Year 2009 for all of you. This forum is the best for php. Furthermore, I have question about time(). I have this standard date in Dutch "7 januari 2009". How can I got the time() string for this date? Thank you, ayok Quote Link to comment Share on other sites More sharing options...
chronister Posted January 7, 2009 Share Posted January 7, 2009 I am not sure about crossing languages, but I am sure it works the same in Dutch as it would in english. strtotime(); is how I would do it. <?php $time = '7 januari 2009'; $timeString = strtotime($time); echo $timeString; ?> Quote Link to comment Share on other sites More sharing options...
ayok Posted January 7, 2009 Author Share Posted January 7, 2009 No, that doesn't work with other language. I need to convert it to english. I know that with <? setlocale(LC_TIME, "nl_NL"); echo strftime("%e %B %G"); ?> I could get "7 januari 2009", but how to get other way around? Quote Link to comment Share on other sites More sharing options...
thebadbad Posted January 7, 2009 Share Posted January 7, 2009 Have a look at strptime(). Doesn't work on Windows platforms. You should be able to feed some of the returned data to strtotime(), and get your timestamp. How is the date string generated? I know it may be a bit late now, but you should really store a timestamp or a date in standard format (2009-01-07) instead of the local date string, and then generate the local string when needed, with strftime("%e %B %G", timestamp). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.