Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8568193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:03:24+00:00 2026-06-11T18:03:24+00:00

I want to get the date and time in GNU Octave and print it

  • 0

I want to get the date and time in GNU Octave and print it to screen. What is the best way to do this?

I’ve checked the Octave documentation, but I don’t see a function to print out YYYY-MM-DD HH:MM:SS with a one liner simple command.

http://www.gnu.org/software/octave/doc/interpreter/Timing-Utilities.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:03:25+00:00Added an answer on June 11, 2026 at 6:03 pm

    Get the date and time in Octave:

    Number of seconds since epoch as integer:

    time()
    ans = 1.3482e+09
    

    The date(), now() and datestr(...) builtin methods:

    date()
    ans = 20-Sep-2012
    
    datestr(now(), 'yyyy-mm-dd');
    ans = 2022-07-04
    
    str2num(datestr(now(), 'yyyymmddHHMMSS'))
    ans =  20220704165727
    

    Add/Subtract days/months interval from now:

    datestr(addtodate(now(), -20, 'days'), 'yyyy-mm-dd')
    ans = 2022-06-14
    datestr(addtodate(now(), -20, 'month'), 'yyyy-mm-dd')
    ans = 2020-11-04
    

    Format date/time as string with strftime

    strftime ("%r (%Z) %A %e %B %Y", localtime (time ()))
    ans = 09:52:42 PM (EDT) Thursday 20 September 2012
    

    Get yyyy-mm-dd hh:mm:ss format

    strftime ("%Y-%m-%d %H:%M:%S", localtime (time ()))
    ans = 2012-09-20 21:56:07
    

    Sources:

    https://octave.sourceforge.io/octave/function/datestr.html

    https://octave.sourceforge.io/octave/function/strftime.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code get date and time in UK time format but i want INDIAN
I want to store the current date & time which can be get by
I have some date and I want to get last x day before this
I have a shell script that I want to get the date and time
I am having a quite annoying problem. I want to get the current date/time
Is there a way to get the date/time that a service last started in
Is there a way to get current date and time in Yahoo Pipes? I
I have two date and time columns in my database. I want to get
I want to get the date with specific day and time in PHP, like
I want to get today's date. Using Now(), I get both date and time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.