locked
Working with dates B.C. in PowerShell RRS feed

  • Question

  • Unfortunately, the DateTime type only works with dates A.D. Is there any way I can work with dates B.C. in PowerShell? Is there another Win32 class that allows this?
    Tuesday, November 30, 2010 5:54 PM

Answers

  • There are no alternatives in pure .NET/PowerShell.  You will have to call out to another program.
    • Marked as answer by Yog Li Monday, December 6, 2010 9:11 AM
    Saturday, December 4, 2010 4:13 AM

All replies

  • That's a good question...  Are you trying to do something OpsMgr-related or just "regular" PowerShell?
    Thursday, December 2, 2010 12:36 AM
  • Oh, just regular. I want to be able to measure spans between various famous historical events.
    Thursday, December 2, 2010 2:12 PM
  • Fellow PowerShell MVP Richard Siddaway had this to say:

    Just checked the MSDN documentation on DateTime

    "
    The DateTime value type represents dates and times with values ranging from 12:00:00 midnight, January 1, 0001 Anno Domini (Common Era) through 11:59:59 P.M., December 31, 9999 A.D. (C.E.)
    "

    I should have thought to check that myself.  You're out of luck with a default/pure PowerShell implementation.  You may need to see if something like Perl will do.

    • Marked as answer by Marco Shaw Friday, December 3, 2010 1:21 AM
    • Unmarked as answer by David Trimboli Friday, December 3, 2010 2:07 PM
    Friday, December 3, 2010 1:21 AM
  • I know DateTime can't go BC; I noted that in my original post. I was wondering if there is any kind of alternative in PowerShell that anyone had noticed.
    Friday, December 3, 2010 2:08 PM
  • There are no alternatives in pure .NET/PowerShell.  You will have to call out to another program.
    • Marked as answer by Yog Li Monday, December 6, 2010 9:11 AM
    Saturday, December 4, 2010 4:13 AM