Home > Software engineering >  In the former data query date field
In the former data query date field

Time:10-25

In the former data query a birthday field, all people are into the 1970-1-1 birthday,
Statement: select the name, sex, birthday from the user;
If change birthday to to_char (birthday, "yy - mm - dd) conversion, query birthday is normal, but the result as a string type, but I want to check out the value of the type is date, to receive with CTime, so can't use to_char conversion,
How ah, everyone?

CodePudding user response:

To_char (birthday, 'yyyy - mm - dd HH24: MI),
Then use sscanf (string, "% d % d - % d % d: % d: % d", & amp; NYear, & amp; NMonth, & amp; NDate, & amp; NHour, & amp; NMin, & amp; NSec); Split
To define CTime ss (nYear nMonth, nDate, nHour, nMin, nSec);
This should be the fastest
  • Related