Results 1 to 9 of 9

Thread: Date field[RESOLVED]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    IL
    Posts
    156

    Date field[RESOLVED]

    Ok i created DB in Access 2003,
    now I created some fields and one of them is Date field (Short Date), it shows like this the date: mm/dd/yyyy
    the problem i must show it like this
    dd/mm/yyyyy
    can it be changed?
    cheers.
    Last edited by ArChAnGeL2k3; Jun 14th, 2004 at 05:06 AM.

  2. #2
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524
    well, ....

    where you need to show it ?
    if you need to show it from VB, you can use format functions...

    format(yourfield,format syntax)

    e.g:
    format(yourfield,"dd-mm-yyyy")
    Regards,
    [-w-]

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    IL
    Posts
    156
    ok , and if I connected my MSFLEX Grid to Data object (Which has this field), how can i change its format?


    thx for the tip.

  4. #4
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524
    sorry man...
    i rarely use MSFLEX...
    but here the sample on another type of object

    VB Code:
    1. private sub format_date()
    2.    dim myRs as New ADODB.Recordset
    3.    'assuming myConn is the connection string
    4.    'assuming there's Textbox object (name = Text1) at the form
    5.  
    6.    myRs.open "select mydatefield from mytable" _
    7.    ,myconn,adopenkeyset,adlockoptimistic,adcmdtext
    8.    
    9.  
    10.    if myrs.recordcount > 0 then
    11.          Text1.Text = Format(myRs!mydatefield, "dd-mm-yyyy")
    12.          msgbox "Press OK to next record !!!"
    13.  
    14.          myrs.movenext
    15.    end if
    16.    
    17.    myrs.close
    18.    set myrs = nothing
    19. end sub

    well, I believe for another object will be almost the same
    Regards,
    [-w-]

  5. #5
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    Format it in the Sql statement
    eg
    Code:
    select ...... format(datefield,"dd mmm yyyy") as Ddate..... from ....
    All dates are just a number past a starting point, so if you store them properly, its just a matter of displaying them how you choose.


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  6. #6
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524
    Originally posted by Ecniv
    Format it in the Sql statement
    eg
    Code:
    select ...... format(datefield,"dd mmm yyyy") as Ddate..... from ....
    are you sure there is format function at SQL ?
    I don't think there is.

    I try, result :
    'format' is not a recognized function name.
    Regards,
    [-w-]

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    IL
    Posts
    156
    Originally posted by Ecniv
    Format it in the Sql statement
    eg
    Code:
    select ...... format(datefield,"dd mmm yyyy") as Ddate..... from ....
    All dates are just a number past a starting point, so if you store them properly, its just a matter of displaying them how you choose.


    Vince

    thx man , thats what iw as looking, and btw i already did it but i didnt updated to RESOLVED this thread, this function woks great!
    but there is one more thing bothering me, in the DDB itself i made the format dd/mm/yyyy so why the hell it didnt showed me it correctly?

    You just write in ur select:
    sql="SELECT ffield1, field2, field3, FORMAT(field4,'DD/MM/YYYY') FROM tblTable"



    thx alot guys!, cheers.
    Last edited by ArChAnGeL2k3; Jun 14th, 2004 at 05:06 AM.

  8. #8
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Date field[UNRESOLVED]

    Originally posted by ArChAnGeL2k3
    Ok i created DB in Access 2003,
    Format in Sql Statement of Access Sql ... well was there in 97 and 2000 so prolly there in 2003. Its not a standard function of Sql statements, but each db has their own additions...


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  9. #9
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    Originally posted by ArChAnGeL2k3
    but there is one more thing bothering me, in the DDB itself i made the format dd/mm/yyyy so why the hell it didnt showed me it correctly?
    The ADO connection has defaulted it. Probably. hehe I have no idea really. Might be windoze infecting it and changing it, also sometimes happens.

    One of those things
    Glad it works ok


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

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



Click Here to Expand Forum to Full Width