Linux converts the value of the time type to the numeric type, how to do it

Updated on technology 2024-03-21
15 answers
  1. Anonymous users2024-02-07

    There is no need to convert in the shell, and it can be used as a number directly.

    Convert to an integer:

    # echo ""| awk ''96

  2. Anonymous users2024-02-06

    Method 1: echo $ This is to remove the decimal point and everything after it, and only use it for bash

    Method 2: echo $var | awk -f. ''Take the first field with the decimal point as the separator.

    Method 3: echo $var | awk ''In AWK, you can directly use the C function to round up.

  3. Anonymous users2024-02-05

    There are many ways to do this:

    var=method 1: echo$ This is to remove the decimal point and everything after it, and only use it for bash

    Method 2: echo $var | awk -f. ''Take the first field with the decimal point as the separator.

    Method 3: echo $var | awk ''In AWK, you can directly use the C function to round up.

    Method 4: Echo"scale=0;$var/1"|BC -l is calculated with BC.

    Method 5: printf"%.0f"$var This one, unlike the above, is rounded.

  4. Anonymous users2024-02-04

    You can find the following function with the formula to take the integer, for example:

    The basic function prototype int(number) category is a mathematical function.

    The return value is of type integer.

    Function: No greater than number

    The maximum integer, int(3 8)=3,int(.

    Note: int cannot be rounded! Use fix!

    basic int(number) takes the largest integer smaller than number. int(

    int(。

  5. Anonymous users2024-02-03

    It must be garbled, and the content of the file can be displayed as characters. After you write, you can read the size of unsigned int when you read it, and you can read it as well.

  6. Anonymous users2024-02-02

    Write directly.

    The reason for the garbled is because it is his four bytes.

    Whereas, the character is a byte.

    You can try writing a struct, and the member variables of the struct are strings, and the text you write to is garbled. The reason is as mentioned above.

  7. Anonymous users2024-02-01

    Convert it to a string and write it.

  8. Anonymous users2024-01-31

    Let's use LLD.

    It may be necessary to introduce some header files that contain typedef, such as int64

    longlong

    int is not used, it is a basic type, not a typedef defined type.

  9. Anonymous users2024-01-30

    int aa = (int32)((long)4294917296) <32)>>32);

    C is written like this, and C should work as well.

  10. Anonymous users2024-01-29

    How to safely convert between long long(int64) and int(int32) in C depends on the situation.

    The details are as follows: int32 is assigned to int64, because int64 has a larger representation range, and it is safe to assign the value directly at this time;

    int64 is assigned to int32, if the data value in int64 does not exceed the representation range of int32, no problem, if it exceeds the range, it will overflow, and it cannot be safely converted.

  11. Anonymous users2024-01-28

    The int conversion of the bit int32 cannot be as simple as the forced type conversion of c, but it must be done by the algorithm, which is to put it bluntly, the accuracy is reduced. It's not as simple as a conversion. For example, if a 32-bit true color ** is converted to a 16-bit color **, the principle is the same, but the accuracy conversion is reduced.

    2. For example, if the 64-bit int becomes a 32-bit int, it should be that every two bits of the 64-bit int value correspond to a bit of the 32-bit int value, right, the value of the two bits is up to 3, so it should be done, the 64-bit int value bit 0 and bit 1 if=2, then the bit 0 of the 32-bit int value is set to 1, if < 2, then the bit 0 of the 32-bit int value is set to 0, and the bit 2 and bit 3 of the 64-bit int data correspond to the bit 1 of the 32-bit int value.

  12. Anonymous users2024-01-27

    Just use if to determine each different situation, and then take the mold.

  13. Anonymous users2024-01-26

    Edition above the time:

    alter table your table name alter column column name type your new type.

    Edition of the following time:

    Dump the table to be modified, modify it directly in the dump file, and then import it back into the channel database.

    This is a bit dangerous, and if the data type is not the same, it will go wrong. For example, from a character type to a numeric type.

  14. Anonymous users2024-01-25

    Version: alter

    table name: alter

    column

    Column name type

    New type edition. Wait: To modify.

    dumpdump file.

    Direct modification. Then re-import the channel database.

    Some dangerous data types are in question.

    than from a character type to a number type.

  15. Anonymous users2024-01-24

    Run psql.

    Go to Run SQL

    alter table your table name alter column column name type your new type.

Related questions
6 answers2024-03-21

1. First, connect to the corresponding Linux host, enter the Linux command line state, and enter the specified path. >>>More

18 answers2024-03-21

Is your "2012-07-23" a field? If you can directly use the substitution function to replace the year, month and day with "-", it will save trouble.

10 answers2024-03-21

The screen-off clock displays information such as time and date when the screen is off. >>>More

12 answers2024-03-21

There are many people of the same age as the elderly in the nursing home, and the old people can play chess, dance, and play together with other elderly people in the nursing home, which can also increase the fun of the old people in life, better spend their old age, make life more pleasant, and feel comfortable, which is very helpful to the life and health of the elderly, so the children send the elderly to the nursing home, which is not an unfilial behavior, but also a good way to achieve a win-win situation for both parties. >>>More

5 answers2024-03-21

What do you think is the standard of "good"?