-
Datetime value to string in PHP
This one escapes me everytime I need which results to much googling. The function is to convert SQL datetime value to human-readable format. /* * Converts the likes of ’2010-08-01 14:57:15′ to ’August 1, 2010, 2:57 pm’ */ $datetime_value =”2010-08-01 14:57:15″; echo date( ”F j, Y, g:i a”, strtotime( $datetime_value ) ); Here’s another example which you will see on some of my templates. <?php echo date(‘Y-m-d’, strtotime(‘next month’)); ?> For more formats, go head to…
-
Trim String in C++
Funny how a trivial task like trimming trailing spaces in C++ gets a bit harder if you insist on using STL (standard template library). But the good thing is, the internet is there and Google is so good at finding the right answer if you ask the right question. And after reading some samples, I…
-
String Replace in C++
As I’m just a C++ poser, I don’t know a lot of things programming in this language especially if I have to deal with STL (Standard Template Library). As some of you know, when you’re not using third party libraries in C++, programming gets a little harder (note : my harder is harder than your…
Recent Comments