girish.kc Posted January 4, 2012 Share Posted January 4, 2012 Hi, I'm working on an application which interacts with an embedded device. Here I'm sending the time in EDT. The following code is used to send the time: $time = date_format(date_create(null, timezone_open("EDT")), "s,i,H,d,m,Y,w"); Here 'm' is from 01 to 12. But at the receiving end the firmware expects the month to be in the range 0-11 (C-style). Yes I can explode the "$time" and subtract 1 from month. But is there any better way to do that..? Thanks, Girish Quote Link to comment https://forums.phpfreaks.com/topic/254331-date-format-mismatch-with-c/ Share on other sites More sharing options...
kicken Posted January 4, 2012 Share Posted January 4, 2012 Not really. There is no format code that will give you what you want, so you have to get the 1-12 version and subtract one. There's various ways you can accomplish that, all probably just as good as any other. Quote Link to comment https://forums.phpfreaks.com/topic/254331-date-format-mismatch-with-c/#findComment-1304096 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.