DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 7 of 7

Thread: Date & Time

  1. #1
    Randy Guest

    Date & Time


    I am returning the system date and time with NOW function and displaying it
    in a text box. The user then saves the data to an Access 2000 database.
    The field the date is being saved is a general date field. When the user
    displays that same record in a MSHFlexGrid the date shows up in yyyy-dd-mm
    24 hour time format. I am populating my MSHFlexGrid by DESC order on the
    Date field with a recordset. Is there any way to format the Date field in
    the SQL statement when returning the recordset? Or am I going in the wrong
    direction?

    Thanks

    RE

  2. #2
    G. Allen Guest

    Re: Date & Time


    You can use the format function in your Access statement. For example, instead
    of using

    SELECT Now()

    you can use

    SELECT Format(Now(), "yyyy-dd-mm")

    or whatever other formating string will make it look the way you want. I
    don't have much experience with the FlexGrid but the formating should carry
    over to there.

    "Randy" <reverett@naeci.com> wrote:
    >
    >I am returning the system date and time with NOW function and displaying

    it
    >in a text box. The user then saves the data to an Access 2000 database.
    >The field the date is being saved is a general date field. When the user
    >displays that same record in a MSHFlexGrid the date shows up in yyyy-dd-mm
    >24 hour time format. I am populating my MSHFlexGrid by DESC order on the
    >Date field with a recordset. Is there any way to format the Date field

    in
    >the SQL statement when returning the recordset? Or am I going in the wrong
    >direction?
    >
    >Thanks
    >
    >RE



  3. #3
    Paul Clement Guest

    Re: Date & Time

    On 17 Apr 2001 08:17:24 -0700, "Randy" <reverett@naeci.com> wrote:

    ¤
    ¤ I am returning the system date and time with NOW function and displaying it
    ¤ in a text box. The user then saves the data to an Access 2000 database.
    ¤ The field the date is being saved is a general date field. When the user
    ¤ displays that same record in a MSHFlexGrid the date shows up in yyyy-dd-mm
    ¤ 24 hour time format. I am populating my MSHFlexGrid by DESC order on the
    ¤ Date field with a recordset. Is there any way to format the Date field in
    ¤ the SQL statement when returning the recordset? Or am I going in the wrong
    ¤ direction?
    ¤
    ¤ Thanks
    ¤
    ¤ RE

    Have you tried using the Format function in your SQL statement?


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

  4. #4
    Randy Guest

    Re: Date & Time


    Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:
    >On 17 Apr 2001 08:17:24 -0700, "Randy" <reverett@naeci.com> wrote:
    >

    >¤ I am returning the system date and time with NOW function and displaying

    it
    >¤ in a text box. The user then saves the data to an Access 2000 database.
    >¤ The field the date is being saved is a general date field. When the user
    >¤ displays that same record in a MSHFlexGrid the date shows up in yyyy-dd-mm
    >¤ 24 hour time format. I am populating my MSHFlexGrid by DESC order on

    the
    >¤ Date field with a recordset. Is there any way to format the Date field

    in
    >¤ the SQL statement when returning the recordset? Or am I going in the

    wrong
    >¤ direction?

    >¤ Thanks

    >¤ RE
    >
    >Have you tried using the Format function in your SQL statement?
    >
    >
    >Paul ~~~ pclement@ameritech.net
    >Microsoft MVP (Visual Basic)


    Yes, but I may not be getting the syntax right. The following is the code
    where I am returning the recordset that I am sending to the MSHFlexGrid.
    How would I use the format option in this SQL statement?

    RE

  5. #5
    Randy Guest

    Re: Date & Time


    "Randy" <reverett@naeci.com> wrote:
    >
    >Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:
    >>On 17 Apr 2001 08:17:24 -0700, "Randy" <reverett@naeci.com> wrote:
    >>
    >>¤
    >>¤ I am returning the system date and time with NOW function and displaying

    >it
    >>¤ in a text box. The user then saves the data to an Access 2000 database.
    >>¤ The field the date is being saved is a general date field. When the

    user
    >>¤ displays that same record in a MSHFlexGrid the date shows up in yyyy-dd-mm
    >>¤ 24 hour time format. I am populating my MSHFlexGrid by DESC order on

    >the
    >>¤ Date field with a recordset. Is there any way to format the Date field

    >in
    >>¤ the SQL statement when returning the recordset? Or am I going in the

    >wrong
    >>¤ direction?
    >>¤
    >>¤ Thanks
    >>¤
    >>¤ RE
    >>
    >>Have you tried using the Format function in your SQL statement?
    >>
    >>
    >>Paul ~~~ pclement@ameritech.net
    >>Microsoft MVP (Visual Basic)

    >
    >Yes, but I may not be getting the syntax right. The following is the code
    >where I am returning the recordset that I am sending to the MSHFlexGrid.
    > How would I use the format option in this SQL statement?
    >
    >RE

    I guess it would help if I included the SQL Statement.

    rstSerialNum.Open ("Select Day, Reading, UserName, ComputerName," & _
    "Location, TruckNumber, MapNumber From Inventory Where SerialNum like
    " & _
    strSerialNum1 & " ORDER BY Day DESC"), _
    cnnInventory, adOpenStatic, adLockOptimistic, adCmdText

  6. #6
    Steve Berzins Guest

    Re: Date & Time

    SELECT Format(Day, "mm/dd/yyyy"), x, y, z FROM...

    "Randy" <reverett@naeci.com> wrote in message
    news:3adc7e41$1@news.devx.com...
    >
    > "Randy" <reverett@naeci.com> wrote:
    > >
    > >Paul Clement <UseAdddressAtEndofMessage@swspectrum.com> wrote:
    > >>On 17 Apr 2001 08:17:24 -0700, "Randy" <reverett@naeci.com> wrote:
    > >>
    > >>¤
    > >>¤ I am returning the system date and time with NOW function and

    displaying
    > >it
    > >>¤ in a text box. The user then saves the data to an Access 2000

    database.
    > >>¤ The field the date is being saved is a general date field. When the

    > user
    > >>¤ displays that same record in a MSHFlexGrid the date shows up in

    yyyy-dd-mm
    > >>¤ 24 hour time format. I am populating my MSHFlexGrid by DESC order on

    > >the
    > >>¤ Date field with a recordset. Is there any way to format the Date

    field
    > >in
    > >>¤ the SQL statement when returning the recordset? Or am I going in the

    > >wrong
    > >>¤ direction?
    > >>¤
    > >>¤ Thanks
    > >>¤
    > >>¤ RE
    > >>
    > >>Have you tried using the Format function in your SQL statement?
    > >>
    > >>
    > >>Paul ~~~ pclement@ameritech.net
    > >>Microsoft MVP (Visual Basic)

    > >
    > >Yes, but I may not be getting the syntax right. The following is the

    code
    > >where I am returning the recordset that I am sending to the MSHFlexGrid.
    > > How would I use the format option in this SQL statement?
    > >
    > >RE

    > I guess it would help if I included the SQL Statement.
    >
    > rstSerialNum.Open ("Select Day, Reading, UserName, ComputerName," & _
    > "Location, TruckNumber, MapNumber From Inventory Where SerialNum like
    > " & _
    > strSerialNum1 & " ORDER BY Day DESC"), _
    > cnnInventory, adOpenStatic, adLockOptimistic, adCmdText




  7. #7
    Guest

    Re: Date & Time


    "Randy" <reverett@naeci.com> wrote:
    >
    >I am returning the system date and time with NOW function and displaying

    it
    >in a text box. The user then saves the data to an Access 2000 database.
    >The field the date is being saved is a general date field. When the user
    >displays that same record in a MSHFlexGrid the date shows up in yyyy-dd-mm
    >24 hour time format. I am populating my MSHFlexGrid by DESC order on the
    >Date field with a recordset. Is there any way to format the Date field

    in
    >the SQL statement when returning the recordset? Or am I going in the wrong
    >direction?
    >
    >Thanks
    >
    >RE



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links