DateTime format reference in SQL command

Source: Internet
Author: User
Tags datetime iso 8601 local time reference
Reference
DateTime format encyclopedia in SQL commands

Code in C #:
DateTime mydate = DateTime.Now;
sSQL = "Insert into Article (title,createddate) Values (' New Title ', '" + Mydate.format ("G", NULL) + "");
Format character reference table:

Format character
Description

Default return Format

D
Short Date pattern
Mm/dd/yyyy
D
Long Date Pattern
dddd, MMMM DD, yyyy
F
Full (long date + short time)
dddd, MMMM dd, yyyy hh:mm
F
Full date (long date + long)
dddd, MMMM dd, yyyy HH:mm:ss
G
General (Short date + short time)
MM/DD/YYYY hh:mm
G
General (Short date + long time)
MM/DD/YYYY HH:mm:ss
Mm
Month Day pattern
MMMM DD
R,r
RFC1123 pattern
DDD, dd MMM yyyy HH ': ' mm ': ' SS ' GMT '
S
Sortable date pattern:conforms to ISO 8601
YYYY-MM-DD HH:mm:ss
T
Short time pattern
hh:mm
T
Long Time Pattern
HH:mm:ss
U
Similar to "s" but uses universal Time instead of the local time.
YYYY-MM-DD HH:mm:ss
U
Universal Sortable Date pattern
dddd, MMMM dd, yyyy HH:mm:ss
Y,y
Year Month pattern
MMMM, yyyy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.