Date Format Problem

Results 1 to 3 of 3

Thread: Date Format Problem

  1. #1
    Join Date
    Dec 1969
    Posts
    716

    Default Date Format Problem

    Hiyas all, <BR><BR>I have a page that displays the results of a SELECT * statement, but when trying to get the date into the display format that I want I run into a problem. If I use the code shown below I end up with the date variable showing as 31st December 1899 (lol). Strange. Although it IS in the format I want it just doesn&#039t seem to be passing the variable information through. I&#039m assuming it&#039s because I haven&#039t specified that it&#039s stored in the CurrentRecordSet - CRSet.<BR><BR>&#060;TD&#062;&#060;%= CRset.fields("Name") %&#062;&#060;/TD&#062;<BR>&#060;TD&#062;&#060;%= FormatDateTime(Thedate,1) %&#062;&#060;/TD&#062;<BR>&#060;TD&#062;&#060;%= CRset.fields("Comments") %&#062;&#060;/TD&#062;<BR><BR>If I use the following code I get the correct information (ie 27/08/99) displayed .. but in the wrong format .. arghh. I&#039ve tried a few variations - trying to include the CRset.fields and the FormatDateTime information all in the same line, but whatever I try seems to get me an error =(<BR><BR>&#060;TD&#062;&#060;%= CRset.fields("Thedate") %&#062;&#060;/TD&#062;<BR><BR>I&#039m sure it&#039s something easy I shouldn&#039t have missed .. but what is it? :o<BR><BR>Thanks in advance for any help =)<BR><BR>Justin

  2. #2
    Join Date
    Dec 1969
    Posts
    1,364

    Default RE: Date Format Problem

    Rewrite your query using a convert statement to get the date converted to a character string in the format you want.<BR>convert(char(8),thedate,101) - 101 is a SQL format code check with the sql help to geet the format you want. If you are not using sql the db yoiu are using will have a comparable function.

  3. #3
    Join Date
    Dec 1969
    Posts
    716

    Default RE: Date Format Problem

    Thanks for the advice Dan. Have you got any examples of this convert code?<BR><BR>TIA,<BR><BR>Justin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •