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 Link to comment https://forums.phpfreaks.com/topic/139836-getting-time/ 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; ?> Link to comment https://forums.phpfreaks.com/topic/139836-getting-time/#findComment-731535 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? Link to comment https://forums.phpfreaks.com/topic/139836-getting-time/#findComment-731617 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). Link to comment https://forums.phpfreaks.com/topic/139836-getting-time/#findComment-731635 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.