Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Is there a way to get just the year from a date?

eric_pestyeric_pesty Member Posts: 1,887 PRO
We would like to include the year in a title block note. There are various "dates" we have access to but I would like just the year part rather than the whole date...

Is there a way to get that somehow?

Best Answer

  • eric_pestyeric_pesty Member Posts: 1,887 PRO
    edited April 2023 Answer ✓
    Nath_McC said:
    I could be wrong, but I do not think you can do this. A little while ago I was looking for something similar but for a copyright date on a drawing template. 
    Yeah that's exactly what I wanted this for...
    I did come up with a "hack" that will do for now: I used the "drawing drawn date", then I formatted it to yyyy-mm-dd, and used a small white rectangular images to hide the part I don't want. I structured things so a line return didn't look out of place after that.

    I created an IR for this, feel free to vote!
    https://forum.onshape.com/discussion/20692/custom-drawing-date-format-or-at-least-separate-year/p1?new=1

Answers

  • Nath_McCNath_McC Member Posts: 127 PRO
    I could be wrong, but I do not think you can do this. A little while ago I was looking for something similar but for a copyright date on a drawing template. 
  • eric_pestyeric_pesty Member Posts: 1,887 PRO
    edited April 2023 Answer ✓
    Nath_McC said:
    I could be wrong, but I do not think you can do this. A little while ago I was looking for something similar but for a copyright date on a drawing template. 
    Yeah that's exactly what I wanted this for...
    I did come up with a "hack" that will do for now: I used the "drawing drawn date", then I formatted it to yyyy-mm-dd, and used a small white rectangular images to hide the part I don't want. I structured things so a line return didn't look out of place after that.

    I created an IR for this, feel free to vote!
    https://forum.onshape.com/discussion/20692/custom-drawing-date-format-or-at-least-separate-year/p1?new=1
  • Nath_McCNath_McC Member Posts: 127 PRO
    The way I was going to complete it was to create a 'list' property and add in the years, then it can be selected from the drawing properties when the document is created
  • eric_pestyeric_pesty Member Posts: 1,887 PRO
    I really didn't want to create a new thing that has to manually be created... 

    However I just had a thought: if you did it this way and updated the "default" value on January first every year, it would probably fill in the correct value automatically for every new drawing wouldn't it? That becomes fairly simple, just one single thing to update once a year...
  • Nath_McCNath_McC Member Posts: 127 PRO
    Yes, I believe you are correct. I just would not want it to update all the old defaults (2023) when you move the default to 2024.
  • eric_pestyeric_pesty Member Posts: 1,887 PRO
    Right, default "shouldn't" do that, it should just pre-fill with the default value when you create a new drawing but would be good to check beforehand!
    Right now the way I have it setup it's "fully automatic" so that the nice part but it does make the formatting a bit of a challenge. If it bothers me too much and I get around to trying the property and default I'll report back!
Sign In or Register to comment.