ankitesh's blog

By ankitesh, history, 16 months ago, In English

Can someone help me how to set date and time in template without actually printing it in terminal? I want to update date and time of submission in template itself without priting it in terminal. I am using python language. It will help me to know the time of submission of code in my template code.

  • Vote: I like it
  • -2
  • Vote: I do not like it

| Write comment?
»
16 months ago, # |
  Vote: I like it +3 Vote: I do not like it

I use cp editor for inserting date and time

  • »
    »
    16 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    can you please share your whole code , i also use cpeditor but i have no idea on how to do it

    • »
      »
      »
      16 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      go to options -> preferences -> competetive companion -> content of the head comments -> add this line there "${time}".

      you need this extension to be installed.

»
16 months ago, # |
Rev. 6   Vote: I like it +3 Vote: I do not like it

If you are using Visual Studio Code, first open User Snippets (by clicking the settings icon in the bottom left and you will see it), then choose python.json, or cpp.json, or any language you want..., then do like this

The instructions about user snippets are written very detailed here: Instructions

For inserting date and time:

CURRENT_YEAR The current year

CURRENT_YEAR_SHORT The current year's last two digits

CURRENT_MONTH The month as two digits (example '02')

CURRENT_MONTH_NAME The full name of the month (example 'July')

CURRENT_MONTH_NAME_SHORT The short name of the month (example 'Jul')

CURRENT_DATE The day of the month as two digits (example '08')

CURRENT_DAY_NAME The name of day (example 'Monday')

CURRENT_DAY_NAME_SHORT The short name of the day (example 'Mon')

CURRENT_HOUR The current hour in 24-hour clock format

CURRENT_MINUTE The current minute as two digits

CURRENT_SECOND The current second as two digits

CURRENT_SECONDS_UNIX The number of seconds since the Unix epoch