Forums

This topic is locked

Sorting AM/PM

Posted 27 May 2002 06:54:36
1
has voted
27 May 2002 06:54:36 David Hayes posted:
I'm creating a schedule page that displays all of the current days times. I have it so that it sorts the list by the Start_time Column in the SQL statement, it works great until I mix in both AM and PM records

Here is the current syntax that each Start_Time is stored in:
HH:MM:SS AP

Any Ideas on how I could sort the Start_time by AM/PM?

Thanks,
fliquid

Replies

Replied 27 May 2002 08:21:13
27 May 2002 08:21:13 Matthijs Horsman replied:
what datavase/server language do you use?

Matthijs
----------------
UD4/WY2K/IIS/ASP-VB
www.chaps.nl
Replied 27 May 2002 18:43:37
27 May 2002 18:43:37 David Hayes replied:
I use ASP(VBscript) with an access database. Sorry I should of mentioned this before. <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 27 May 2002 19:32:48
27 May 2002 19:32:48 David Behan replied:
I had a tricky client that was very particular about their dates. They wanted them in 24 hour clock and AM/PM format. I didn't know of an automatic script that did this so here is what I did:

<b>I used the Ultradev dodatetime function:</b>

&lt;SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT&gt;
function DoDateTime(str, nNamedFormat, nLCID)
dim strRet
dim nOldLCID
strRet = str
If (nLCID &gt; -1) Then
oldLCID = Session.LCID
End If
On Error Resume Next
If (nLCID &gt; -1) Then
Session.LCID = nLCID
End If
If ((nLCID &lt; 0) Or (Session.LCID = nLCID)) Then
strRet = FormatDateTime(str, nNamedFormat)
End If
If (nLCID &gt; -1) Then
Session.LCID = oldLCID
End If
DoDateTime = strRet
End Function
&lt;/SCRIPT&gt;


<b>AND this for the display of the time format they wanted:</b>

&lt;%= DoDateTime((rsInfo.Fields.Item("ts_departure".Value), 4, 1033) %&gt;
&lt;% IF (rsInfo.Fields.Item("ts_departure".Value) &lt; #12:00# THEN Response.Write " AM" ELSE Response.Write " PM" END IF %&gt;



Try something like that and see...

Regards

Dave

_________________________
David Behan - www.site-manager.com/af.asp?a=11&l=1tds9p6x2

Reply to this topic