[thelist] SQL Server DateTime Format

NanHarbisonSmith at aol.com NanHarbisonSmith at aol.com
Tue Jun 18 12:01:26 CDT 2002


--
[ Picked text/plain from multipart/alternative ]
Could the built in PHP date formatting have been helpful here? I wanted to
suggest it, but I was not sure if you could use it to change a date already
formatted in a DB to a different format.
Date formatting in PHP:
http://www.php.net/manual/en/function.date.php
Thanks,
Nan

In a message dated 6/18/2002 12:44:19 PM Eastern Daylight Time,
burhankhalid at members.evolt.org writes:


> You didn't specify a language -- so I'll shoot some code in PHP :
>
> $str_dateTime = "6/18/02 9:20:22 AM"; //Original Date Time
> list($str_date,$str_time,$str_ampm) = $explode (" ",$str_dateTime); //
> get parts
> list($int_hour,$int_minutes,$int_secs) = $explode(":",$str_time); // get
> parts of time
> if (((int)$int_hour) < 10) {
>     $str_formattedTime = $str_date." 0".$int_hour.$int_minutes;
> } else { $str_formattedTime = $str_date." "$int_hour.$int_minutes; }
>
> hth,
> Burhan


Nan Harbison Smith
481 Elm Street
Concord, MA 01742
978-369-1224
978-369-1681

Deja Moo -- the feeling that you've heard this bull before






More information about the thelist mailing list